nginx 301重定向几种写法

nginx 301重定向写法
域名设置从http强制跳转到https

server {
listen 80;
server_name 100tt.com www.100tt.com 100tt.me 100tt.vip 100tt.org;
rewrite ^(.*)$ https://$host$1 permanent;
}

或者以下写法,从一个域名跳到另一个域名,但是这些域名都是nginx配置上有的域名

server {
server_name 666.com www.666.com;
if ($host ~ '666.com | www.666.com' ) {
rewrite ^/(.
)$ http://888.com/$1 permanent;
}

}

猜你喜欢

转载自blog.51cto.com/8999a/2119998