Https导致Safari重定向过多 [英] Https causes too many redirects on Safari
问题描述
我最近开始将域重定向到 https
,并且在Safari上出现重定向过多错误,尤其是在移动设备上。一切都可以在任何计算机和任何其他浏览器上正常运行。
I recently started redirecting my domain to https
and I am getting a "too many redirects" error on Safari, especially on mobile. Everything works fine on any computers and in any other browsers.
这是我进行重定向的方式。
Here's how I've done my redirects.
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://example\.com%{REQUEST_URI} [R=301,L,NE]
我也禁用了Cloudflare,因为它引起了我的SSL问题,并且我解决了DNS传播方面的一些问题。
I also disabled Cloudflare because it was causing issues with my SSL and I fixed some issues with DNS propagation.
编辑:
它会影响除计算机以外的所有野生动物园浏览器,删除缓存并不能解决问题。我只有一个域,但有几个子域。
It affects all safari browsers except for computers and deleting the cache doesn't solve the issue. I only have one domain, but a few subdomains.
.htaccess中确实还有其他指令:
I do have other directives in .htaccess:
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^folder\/?(.*)$ "http\:\/\/example\.com\/all\-categories\/folder\/$1" [R=301,L]
编辑:已解决
更改主机已解决此问题对我来说是个问题。
Changing host solved this problem for me.
推荐答案
我使用以下方法修复了该问题
I fixed it by using following method
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond%{HTTPS} off
RewriteCond %{HTTPS} off
导致错误。使用
RewriteCond%{SERVER_PORT}!^ 443 $
RewriteCond %{SERVER_PORT} !^443$
对其进行修复。
这篇关于Https导致Safari重定向过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!