nginx 重写排除子域
nginx rewrite exclude subdomains
我需要重定向:
http://*.example.com/list/
到
http://demo.example.com/list/
从重写规则链接中排除:
xxx.example.com/list/
yyy.example.com/list/
zzz.example.com/list/
这应该是一个正则表达式,对吧?..但我是新手。提前Tnx.
server {
listen 80;
server_name .example.com;
location /list/ {
if ($host !~ ^(xxx|yyy|zzz)\.example\.com) {
return 301 http://demo.example.com/list/;
}
# ....
}
}
我需要重定向:
http://*.example.com/list/
到
http://demo.example.com/list/
从重写规则链接中排除:
xxx.example.com/list/
yyy.example.com/list/
zzz.example.com/list/
这应该是一个正则表达式,对吧?..但我是新手。提前Tnx.
server {
listen 80;
server_name .example.com;
location /list/ {
if ($host !~ ^(xxx|yyy|zzz)\.example\.com) {
return 301 http://demo.example.com/list/;
}
# ....
}
}