例如:example.com 跳转到 www.example.com
server {
listen 80;
server_name example.com;
rewrite ^/(.*)$ http://www.example.com/$1 redirect;
access_log off;
}
本文为“技术点滴”的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
例如:example.com 跳转到 www.example.com
server {
listen 80;
server_name example.com;
rewrite ^/(.*)$ http://www.example.com/$1 redirect;
access_log off;
}