Nginx no-www to www,www to no-www
server { listen 80; server_name www.example.com example.com; root /var/www/www.example.com/web; if ($http_host != "www.example.com") { rewrite ^ http://example.com$request_uri permanent; }
server { listen 80; server_name example.com; root /var/www/www.example.com/web; if ($http_host != "www.example.com") { rewrite ^ http://example.com$request_uri permanent; }
if ($host = 'www.example.com' ) { rewrite ^ http://example.com$uri permanent; }
site.com 192.192.6.8 A type at 300 seconds www.site.com 192.192.6.8 A type at 300 seconds
侃侃无极
相关分类