(19个答案)4天前关闭。我想了解正确的Nginx配置是什么,以重定向到http://example.com/的一切...即:
yyyllmsg1#
你可以这样做:
server { listen 80; server_name www.example.com; return 301 $scheme://example.com$request_uri; } server { listen 80; server_name example.com; <your other nginx settings> } server { listen 443; server_name www.example.com; return 301 $scheme://example.com$request_uri; } server { listen 443; server_name example.com; return 301 http://example.com$request_uri; }
1条答案
按热度按时间yyyllmsg1#
你可以这样做: