My domain name is example.com
I want www.example.com to jump to example.com
My nginx configuration is
server { listen 80; server_name www.example.com example.com; root /var/www/web; if ($http_host == "www.example.com") { rewrite ^ http://example.com$request_uri permanent; }
no. . .
大家讲道理2017-05-16 17:31:53
server { listen 80; server_name www.example.com; return 301 http://example.com/$request_uri; } server { listen 80; server_name example.com; root /var/www/web; }
某草草2017-05-16 17:31:53
if ($host = 'www.example.com' ) { rewrite ^/(.*)$ http://example.com/$1 permanent; }
天蓬老师2017-05-16 17:31:53
if ($http_host = www.example.com) { rewrite (.*) http://example.com$1 permanent; }