Maison > Questions et réponses > le corps du texte
Mon nom de domaine est exemple.com
Je veux que www.example.com accède à example.com
Ma configuration nginx est
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; }
Non. . .
大家讲道理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/ permanent; }
天蓬老师2017-05-16 17:31:53
if ($http_host = www.example.com) { rewrite (.*) http://example.com permanent; }