[英]nginx rewrite exclude subdomains
I need to redirect: 我需要重定向:
http://*.example.com/list/
to 至
http://demo.example.com/list/
excluding from rewrite rule links: 从重写规则链接中排除:
xxx.example.com/list/
yyy.example.com/list/
zzz.example.com/list/
This should be a regex, right?.. But i'm newbie here. 这应该是一个正则表达式,对吗?。但是我是新手。 Tnx in advance.
提前Tnx。
server {
listen 80;
server_name .example.com;
location /list/ {
if ($host !~ ^(xxx|yyy|zzz)\.example\.com) {
return 301 http://demo.example.com/list/;
}
# ....
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.