尝试将http重定向到https时,仅使用htaccess在safari中重定向循环 [英] Redirect Loop ONLY in safari using htaccess when trying to redirect http to https
本文介绍了尝试将http重定向到https时,仅使用htaccess在safari中重定向循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道为什么会这样,但是当我使用野生动物园以外的任何其他浏览器访问我的网站时,它会将我重定向到https版本。但是,如果我使用野生动物园(在iPhone,Mac或iPad上)访问同一站点,则表示存在重定向循环。
I don't know why this is happening, but when I visit my site from any other browser other than safari, it redirects me to the https version. However, if I visit the same site using safari (on iPhone, mac, or iPad), it says there is a redirect loop.
我的htaccess代码:
My htaccess code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
Options -Indexes
</IfModule>
我不知道为什么会这样。非常感谢您的帮助。谢谢!
I don't know why this is happening. Any help is highly appreciated. Thanks!
推荐答案
我改用了此解决方案。
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
这篇关于尝试将http重定向到https时,仅使用htaccess在safari中重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文