【问题标题】:.htaccess causing redirect loop on safari only - http to https.htaccess 仅在 Safari 上导致重定向循环 - http 到 https
【发布时间】:2016-03-27 21:51:51
【问题描述】:

这只发生在野生动物园中。我不知道为什么。谷歌浏览器、火狐,一切正常。

在任何 Apple 产品上,使用 safari,我都会得到一个重定向循环:

代码:

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:

 RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

【问题讨论】:

  • 你输入什么网址? www.example.com ?
  • 大声笑没有。这只是一个例子。

标签: .htaccess redirect safari


【解决方案1】:

尝试更改两个重定向以直接转到所需位置:

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]

【讨论】:

    猜你喜欢
    • 2015-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 1970-01-01
    • 2017-04-17
    • 1970-01-01
    • 2014-09-29
    相关资源
    最近更新 更多