动态js/css和SSL的问题


Wordpress - problems with dynamic js/css and SSL

(与这个论坛的另一个问题有关,我想我会试着重新措辞并放在WordPress区域…)

试图通过SSL加载WordPress站点"domain.com"。证书安装正确,所有链接到图形和其他文件都正确转换为https的url,除了我得到这些错误:

[blocked] The page at https://domain.com/ ran insecure content from http://domain.com/?dynamic=css.
[blocked] The page at https://domain.com/ ran insecure content from http://domain.com/?dynamic=js.

相关的HTML如下:

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('url'); ?>/?dynamic=css" />

<script type="text/javascript" src="<?php bloginfo('url'); ?>/?dynamic=js"></script>

所以它看起来像我有一个障碍加载动态生成的css或js通过SSL。Debian/输入。有人知道怎么修吗?谢谢你。

我还没有看到任何浏览器完全禁止不安全的内容,但是IE会显示一个警告。

如果指定了HTTPS,解决方案是每个资源都通过SSL加载。

一个很好的协议无关技术是简单地写//example.com而不是https://example.comhttp://example.com。协议将由当前正在使用的协议决定。

因此,如果您在http://example.com/checkout/上,那么资源将使用http://example.com作为基础。如果连接是安全的,资源将自动指向https://example.com,而不需要任何条件代码。

在Wordpress管理面板中,您可以指定bloginfo('url')返回的URL。

编辑:有一种方法可以直接在HTML中做到这一点。修改bloginfo('url');str_replace('http:', '', bloginfo('url'));

你可以使用一个插件来强制通过SSL (https)获取资产:http://wordpress.org/extend/plugins/wordpress-https/