2016年1月3日 星期日

Nginx 將舊domain轉移到新domain

原本有個舊的domain是 *.old.com
需要全部轉向到新申請的domain  *.new.com
透過regular expression

server {
    listen 80;
    listen 443;
    server_name ~^((?<subdomain>.*)\.)old.com$;
    return 301 https://${subdomain}.new.com$request_uri;
}

沒有留言:

張貼留言