Heim > Fragen und Antworten > Hauptteil
Mein Domainname ist example.com
Ich möchte, dass www.example.com zu example.com springt
Meine Nginx-Konfiguration ist
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; }
Nein. . .
大家讲道理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; }