2014-03-28 40 views
-3

htaccess重寫規則對我毫無意義!我只是想重定向如下:將所有的www和http重定向到赤裸裸的https

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

https://domain.com

+0

[可能的重複。 htaccess重定向到https:// www](http://stackoverflow.com/questions/14237805/htaccess-redirect-to-https-www)和http://stackoverflow.com/questions/13977851/htaccess-redirect-to -https-www?rq = 1 – ceejayoz

+0

那些都想要重定向到www。我想重定向到裸體網址。 –

+0

應該很容易找出如何做相反的事情。 – ceejayoz

回答

0

你可以在你的根.htaccess文件中使用這樣的規則:

RewriteEngine On 

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

我知道我不是提問者,但我試過,它不會將「https:// www.domain.com」重定向到「https:// domain.com」 – Howli

+0

如果在正確的位置使用此規則,則此規則明確無誤。在此之前不應有任何規則。 – anubhava

相關問題