鍍金池/ 問答/Python  Linux  HTML/ https下老域名301轉(zhuǎn)到https新域名如何實(shí)現(xiàn)?

https下老域名301轉(zhuǎn)到https新域名如何實(shí)現(xiàn)?

老域名是二級(jí)域名,最近拿下了新域名并且注冊備案也下來了,目前就剩下原來老域名https網(wǎng)址無法301跳轉(zhuǎn)至新域名,http的利用DNS解析提供的301跳轉(zhuǎn)完美搞定,就是只要是https前綴的老域名網(wǎng)址鏈接無法跳轉(zhuǎn)到對應(yīng)的新域名鏈接網(wǎng)址。
具體示例:
https://old.domain.com/123.html跳轉(zhuǎn)到https://www.new.com/123.html
這樣的跳轉(zhuǎn)都是錯(cuò)誤的
只有http://old.domain.com/123.html跳轉(zhuǎn)到https://www.new.com/123.html
才可以。
系統(tǒng)環(huán)境是LNMP的!求高手賜教我該如何解決這種https之間的301跳轉(zhuǎn)!

回答
編輯回答
枕頭人
server {
        listen          80;
        server_name     old.domain.com;
        location /123.html {
         rewrite ^(.*)$  https://www.new.com$1 permanent;
        }
}

https 的rewrite也一樣

if ( $scheme = "http" ) {
    return 301 https://www.new.com$request_uri;
    ......
2017年6月23日 01:44