1
我的域名www.abc.com現在重定向到https://www.abc.co.uk重定向特定域到HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
這些代碼的工作正是我想要的。之後,我創建了一個子域。 www.x.abc.co.uk 現在我想重定向到http://x.abc.co.uk(不包括HTTPS)
我用這個
RewriteCond %{HTTP_HOST} ^x\.abc\.co\.uk [NC]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
但瀏覽器說,它有重定向循環。
該怎麼辦?
+1需要額外的努力才能將2條規則合併爲一條。 – anubhava