server { listen 80; server_name *.wdzzz.com; if ( $http_host ~* "^(.*?)\.wdzzz\.com$"){ set $domain $1; } rewrite ^/(.*) http://$domain.newdomain.com/$1 permanent; }
原文链接:https://c.larjie.com/nginx-301/,转载请注明出处。
server { listen 80; server_name *.wdzzz.com; if ( $http_host ~* "^(.*?)\.wdzzz\.com$"){ set $domain $1; } rewrite ^/(.*) http://$domain.newdomain.com/$1 permanent; }