.htaccess仅在safari上导致重定向循环-http到https [英] .htaccess causing redirect loop on safari only - http to https
本文介绍了.htaccess仅在safari上导致重定向循环-http到https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这仅发生在野生动物园中。我不知道为什么
This only happens in safari. I don't know why. Google Chrome, Firefox, everything works fine.
在任何Apple产品上,使用野生动物园,我都会得到一个重定向循环:
On any Apple product, using safari, I get a redirect loop:
代码:
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
不知道为什么会这样。如果我删除了它,那么它可以工作,但是不能将http重定向到https,而只能重定向www:
No idea why it happens. If I remove this it works but doesn't redirect http to https, only redirects www:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
推荐答案
尝试更改两个重定向以直接转到所需位置:
Try changing both redirects to go straight to the desired location:
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
这篇关于.htaccess仅在safari上导致重定向循环-http到https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文