【问题标题】:Website folders do not have full SSL lock网站文件夹没有完整的 SSL 锁定
【发布时间】:2016-02-10 10:02:32
【问题描述】:

所以我正在创建一个新网站Link,但由于某种原因,没有文件夹具有完整的 SSL 图标。顶级 index.php 文件有锁,但文件夹内的任何内容,例如 /blog,都有部分 ssl。它有锁,但由于“有人可以更改此页面的外观”类型错误而将其隐藏。请帮忙,因为我不知道为什么会这样。我确实使用 cloudflare,并设置了 http://qualexcraft.tk/* 页面规则来强制使用 https。

更新:现在没有文件夹或文件具有完全锁定

对于任何感兴趣的人,这是我的 htaccess 文件:

# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /
ErrorDocument 404 http://qualexcraft.tk/404
# Redirect www urls to non-www
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.qualexcraft\.tk [NC]
RewriteRule (.*) https://qualexcraft.tk/$1 [R=301,L]

目录结构:

index.php

404

index.php

old.php

资产

images

博客

allPosts

index.php

包括

headers

  head.html

  index.html

layout

  footer.html

  navbar.html

地图

mdl

[mdl files]

【问题讨论】:

  • 您的页面中的链接不多...但/mdl/material.min.js 没问题...
  • 在您的blogpage:http://placehold.it/512x176 更改它,使用https//placehold.it/512x176
  • 试试 /blog,至少在 Chrome 上不起作用
  • 好的,让我试试。问题是,在放置占位符之前它也不起作用。我的第二个编辑器只是把它放进去。试试我的 /404 文件夹,没有完整的 SSL,有“人们可以更改内容”类型的东西。
  • 还是不行。有什么想法吗?

标签: apache .htaccess ssl cloudflare


【解决方案1】:

导致这种行为的原因之一是您的 htaccess 文件中的以下行:

ErrorDocument 404 http://qualexcraft.tk/404

当客户端请求图像https://qualexcraft.tk/blog/images/android-desktop.png 时,会触发302 重定向到http://qualexcraft.tk/404。该页面又将永久重定向设置为https://qualexcraft.tk/404

现在,正如我问in the comment 一样,还有另一条规则在 URL 中添加尾随 / 并将其重定向到 http://qualexcraft.tk/404/。最后,这个;使用状态码 301 重定向到安全页面:https://qualexcraft.tk/404/

中间重定向到http 页面是问题的根本原因。当有人访问您网站上的 blog 链接时,也会发生同样的情况。

https://qualexcraft.tk/blog 的请求被重定向到http://qualexcraft.tk/blog/,然后被重定向到https://qualexcraft.tk/blog/


在您更改网站后,行为仍然相同,只是请求现在针对https://qualexcraft.tk/favicon.ico


尝试将您的 htaccess 更新为以下内容:

Options -MultiViews
DirectorySlash Off
ErrorDocument 404 https://qualexcraft.tk/404

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)/?$ $1/index.php [L]

RewriteCond %{HTTP_HOST} ^www\.qualexcraft\.tk [NC]
RewriteRule (.*) https://qualexcraft.tk/$1 [R=301,L]

【讨论】:

  • 是的,在 chrome 中监控我的网络流量时,我观察到 404 的行为相同。在重定向期间,有一些 404 针对http 而不是https。 @Philippos Slicher 尝试从您的页面中删除 <link rel="icon" sizes="192x192" href="images/android-desktop.png"> 代码,锁定图标应该会返回。如果这样可以解决问题,则上述帖子中与 404 相关的建议应该可以解决问题。由于 301 重定向的缓存特性,请务必清除缓存。
  • 好的,我现在正在尝试。我正在添加图像而不是删除线。
  • @hjpotter92 那么我到底需要做什么呢?
  • @hjpotter92 等等你在哪里看到/blog/images/........应该是/images/android......
  • @PhilipposSlicher 更新了上面的帖子。请检查
【解决方案2】:

将您的网站图标图片添加到 favicon.ico、images/touch/ms-touch-icon-144x144-precomposed.png 和 images/android-desktop.png。这是唯一可以看到的不安全内容错误,因此一旦修复,清除浏览器缓存后就可以了。

为了将来发现混合内容错误,您可以转到 Chrome 中的控制台(右键单击 > 检查元素 > 控制台),您的不安全内容错误将在那里显示。

【讨论】:

  • 是的,我知道控制台部分,但奇怪的是它显示“Insecure favicon: qualexcraft.tk/404”
  • 你能解释一下吗?阅读以上部分。抱歉重复,没有ping通
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-10-05
  • 1970-01-01
  • 1970-01-01
  • 2021-11-04
相关资源
最近更新 更多