找到server段代码
server
{
listen 80;
server_name www.xxxx.com xxxx.com;
}
在server段域名下设置:
if ($host = 'xxxx.com' ) { rewrite ^/(.*)$ http://www.xxxx.com/$1 permanent; }
重启nginx,这样我们就完成了nginx下301的跳转设置。
server { listen 80; server_name xyz.com www.xyz.com if ($host != 'abc.com' ) { rewrite ^/(.*)$ https://abc.com/$1 permanent; } }
把所有绑定的域名跳转到abc.com