2014-04-25 191 views
1

我需要重寫規則的幫助。如何將http重定向到https和https:// www到https://

所以我想這些地址:

http://domain.com 
http://www.domain.com 
https://www.domain.com 

重定向到:

https://domain.com 

有人能幫助我嗎?

現在我有規律:

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://domain.com/$1 [R,L] 

But it doesnt redirect https://www to https:// 

回答

0

將這個規則在DOCUMENT_ROOT/.htaccess文件:

RewriteEngine On 

RewriteCond %{HTTPS} off [OR] 
RewriteCond %{HTTP_HOST} www\. 
RewriteRule^https://domain.com%{REQUEST_URI} [L,R=301,NE] 
+0

耶!其作品。非常感謝:) –

+0

不客氣,很高興它解決了。 – anubhava

相關問題