网站域名不带www的自动跳转到www

原理就是80所有跳到https的www,不带www的https,跳到www的https

server {
listen 80;
server_name moneyslow.com,www.moneyslow.com;
return 301 https://www.moneyslow.com$request_uri;
}
server {
listen 443;
server_name moneyslow.com;
return 301 https://www.moneyslow.com$request_uri;
}
server {
listen 443 default_server ssl;
server_name www.moneyslow.com;
ssl on;
...
}

京ICP备11047313号-19 彩虹岛电子书