.htaccess在Safari中重定向过多
我有htaccess文件,
I have htaccess file consisting of
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Turn SSL on for
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/m/log
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# Turn SSL off
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !^/m/log
RewriteCond %{REQUEST_URI} !^/m/stil
RewriteCond %{REQUEST_URI} !^/m/slike
RewriteCond %{REQUEST_URI} !^/m/slikce
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]
运行正常基本上可以在除iPhone之外的任何其他设备上使用。如何解决它?
It runs fine on basically any other device except iPhone. How to fix it?
使用iPhone6时仅在 / m / log
上发生,在iPhone 4上还可以。无论通过 HTTP
或 HTTPS
还是通过 www访问网站,都会发生这种情况
或裸域。
It happens only on /m/log
while using iPhone6, it's fine on iPhone 4. It happens regardless of whether the site is accessed via HTTP
or HTTPS
, or via www
or the bare domain.
快速浏览了站点本身的网络流量,那么在投放 https://example.com/m/log
(即安全页面)时,您似乎有几张图片(包括 favicon.ico
)被重定向回 http
。这导致混合内容和不安全的连接。一些浏览器可能会发出警告,或者根本不显示通常的挂锁。 (谷歌浏览器省略了绿色的挂锁,但在检查安全信息时仅突出显示了``混合内容''问题。)需要更正此问题。
Having had a quick look at the network traffic on the site itself, it would seem that when serving https://example.com/m/log
(ie. the "secure" page), you have a few images (including the favicon.ico
) that are being redirected back to http
. This results in "mixed content" and an insecure connection. Some browsers might throw up a warning or simply not display the usual "padlock". (Google Chrome omits the green padlock but only highlights the "mixed content" issue when examining the security information.) This needs to be corrected.
如果用户代理(例如,iPhone 6上的Safari)尝试通过重新请求安全资源来纠正(使其安全),然后您最终可能会遇到重定向过多(重定向循环)。
If the user-agent (ie. Safari on iPhone 6) attempts to "correct this" (to make it secure) by re-requesting the secure resource then you could well end up with "too many redirects" (a redirect loop).
有问题的图像(URL)。
The images (URLs) in question.
-
/ slikce / smile .png
(奇怪的是,这还会返回X-Pad:避免浏览器错误
响应标头?) -
/log/slike/1471075891/tm_13950809_10209500982108999_1789026171_o.jpg
-
/favicon.ico
-
/slikce/smile.png
(Curiously, this also returns anX-Pad: avoid browser bug
response header?) /log/slike/1471075891/tm_13950809_10209500982108999_1789026171_o.jpg
/favicon.ico
以上所有URL都显示在安全 HTML页面上,但是,它们被301重定向回 HTTP
遵循.htaccess文件中的规则。
All the above URLs appear on the "secure" HTML page, however, they get 301 redirected back to HTTP
following the rules in your .htaccess file.
(似乎HTTPS请求是由Apache处理的,但是 HTTP
请求由Nginx处理?)
(It also appears that the HTTPS requests are handled by Apache, but the HTTP
requests are handled by Nginx?)
顺便说一句,在iOS 9(iPad)的Safari中测试您的网站时,我也看到此错误...
Incidentally, I'm also seeing this error while testing your site in Safari on iOS 9 (iPad)...
Safari无法打开页面,因为发生了太多的重定向。
Safari cannot open the page because too many redirects occurred.