我有下面的代碼重定向非www到www爲https,它的工作原理:如何將http重定向到https?
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
的問題是,我當我去www.site.com它不重定向到https。我試着也加入代碼下輸入以下代碼在頂部,但我在https://www.www.site.com
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
只需刪除額外的www。 – SteveP 2013-04-10 06:42:48
從哪裏?底端?因爲如果我這樣做,我會得到一個無限循環。 – Cris 2013-04-10 06:47:20