簡體   English   中英

強制nginx將一個域重定向到另一個域,同時保持URL結構?

[英]Force nginx to redirect one domain to another while keeping URL structure?

我正在尋找一種將exampledomain.com重定向到exampledomain2.com的方法,同時還要保持URL結構。 例如:

http://exampledomain.com/forum/post1.php

將重定向到

http://exampledomain2.com/forum/post1.php

有人對此有一個簡單的解決方案嗎? 提前致謝!

應該簡單明了:

server {
    listen 80;
    listen 443 ssl;
    server_name www.old-name.com;
    return 301 $scheme://www.new-name.com$request_uri;
}

請參閱此博客以獲取更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM