我的域名是 example.com我的nginx配置是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;
}不行。
2 回答

翻過高山走不出你
TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超3個(gè)贊
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; }

MYYA
TA貢獻(xiàn)1868條經(jīng)驗(yàn) 獲得超4個(gè)贊
if ($http_host = www.example.com) { rewrite (.*) http://example.com$1 permanent; }
- 2 回答
- 0 關(guān)注
- 495 瀏覽
添加回答
舉報(bào)
0/150
提交
取消