2016-04-14 53 views
1

任何人都可以帮我解决我的问题。htaccess从旧域重定向到新域和https并保留查询字符串

我更改了我的域名wordpress网站,但在同一台服务器上。

旧网站:https://www.old.net
新网站:https://www.new.com

现在我想提出以下重定向:

http:/www.old.net    --> https:/www.new.com 
https:/www.old.net    --> https:/www.new.com 
http:/www.new.com    --> https:/www.new.com 
http:/www.old.net/example-site --> https:/www.new.com/example-site 
https:/www.old.net/example-site --> https:/www.new.com/example-site 
http:/old.net     --> https:/www.new.com 
https:/old.net     --> https:/www.new.com 
http:/old.net/example-site  --> https:/www.new.com/example-site 
https:/old.net/example-site  --> https:/www.new.com/example-site 

等... (我删除了第二个斜杠,所以我可以张贴这么多的例子URls ...)

我希望很清楚我的问题是什么...

我媒体链接尝试这样做:

RewriteCond %{HTTP_HOST} *!^www*.new\.com [NC] 
RewriteRule (.*) https://www.new.com/$1 [L,R=301] 

这:

Options +FollowSymLinks 
RewriteEngine On 
RewriteRule ^(.*) https://www.new.com%{REQUEST_URI} [R=301,NC] 

但是,所有与500错误或无限循环重定向

感谢您的帮助结束!

回答

0

重定向旧网站到新网站,你可以使用:

RewriteEngine on 


RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$ 
RewriteRule^https://www.newsite.com%{REQUEST_URI} [NE,L,R] 
相关问题