server { listen 80; server_name *.olddomain.com; if ( $http_host ~* "^(.*?)\.olddomain\.com$"){ set $domain $1; } rewrite ^/(.*) http://$domain.newdomain.com/$1 permanent; }
server { listen 80; server_name *.olddomain.com; if ( $http_host ~* "^(.*?)\.olddomain\.com$"){ set $domain $1; } rewrite ^/(.*) http://$domain.newdomain.com/$1 permanent; }
转载于:https://www.cnblogs.com/jackspider/p/10100927.html