2013-07-03 69 views
0

我嘗試做以下WWW:在http添加www和消除對HTTPS

加上www到非安全 HTTP:[] // COM域名爲http://www.domain [。]在安全 HTTPS COM

&

remomve WWW:// WWW domain.com到https [。] [。] //域名COM

我想這一點,但似乎並不工作

RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^example.org$ 
RewriteRule ^(.*)$ http://www.example.org/$1 [R=301,L] 

RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} ^example.org$ 
RewriteRule ^(.*)$ https://example.org/$1 [R=301,L] 

回答

0

試試這個:

RewriteCond %{HTTPS} off 
RewriteCond %{HTTP_HOST} ^example\.org$ [NC] 
RewriteRule ^(.*)$ http://www.example.org/$1 [R=301,L] 

RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} ^www\.example\.org$ [NC] 
RewriteRule ^(.*)$ https://example.org/$1 [R=301,L] 

你的第二個HTTP_HOST條件仍然會檢查www.丟失,這應該是周圍的其他方法。

+0

很好用。謝謝! –

相關問題