另一个 nginx 重写规则问题:
我如何从 http://www.*.domain.com
进行重写至 http://*.domain.com
?
最佳答案
if ($host ~* www\.(.*)) {
set $host_without_www $1;
rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo'
}
来自服务器故障的回答:
https://serverfault.com/questions/139579/nginx-subdomain-rewrite
关于url-rewriting - nginx 子域重写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2785538/