2012-12-17 108 views
2

需要http:// www.old-url.com/any/other/url/segment 重定向到https:/ /www.new-url.com/any/other/url/segment的.htaccess的URL重定向到另一个(保持URL段)

目前Im做这样的事情:

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

这个结果:

http:// www.old-url.com/any/other/url/segment to 
https:// www.new-url.com/ 

谢谢 -Robbie

回答

0

使用htaccess的规则下面HTTP重定向到https:

RewriteEngine On 
RewriteCond %{HTTPS} !on 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

来源:htaccess redirect

+0

这会导致'内部服务器Error'我 – vsync