【发布时间】:2017-02-16 00:41:08
【问题描述】:
我遇到了一个关于 wordpress 的奇怪问题。 我已将 wordpress 网站从 http 移至 https,类别页面保持从 http 而不是 https 加载 js 和 css 资源文件,而其他页面都很好。 functions.php 中没有添加类别模板,也没有 is_category() 处理程序。有人知道是什么问题吗?
【问题讨论】:
-
控制台中是否有任何警告或错误?
-
是的,有。
Mixed Content: The page at 'https://staging-1.ponoko.com/blog/category/promotional-products/' was loaded over HTTPS, but requested an insecure script 'http://staging-1.ponoko.com/blog/wp-content/plugins/audio-player/assets/audio-player.js?ver=20100105100911'. This request has been blocked; the content must be served over HTTPS. staging-1.ponoko.com/:202 Uncaught ReferenceError: AudioPlayer is not defined (index):203 -
一个简单的 HSTS (
Header always set Strict-Transport-Security "max-age=31536000") + HTTP2HTTPS 重定向 (RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]) 会在您找到问题出处时修补问题(Apache htaccess 示例)。