SSL 固定内容,为什么在 https 方案中不返回 site_url()
SSL fixed content , why is not returning site_url() , in https scheme
在我的 WordPress 站点中,我在子文件夹中使用另一个 WordPress,例如:https://www.mywpexample.com/wp-newsite
我已经为我的站点设置了 SSL,但突然显示控制台混合内容 https 未加载错误,并且未在站点 css/js/actions 中加载任何资产 (css/js/actions) =14=].
我已经尝试 echo site_url()
它的 return 的 http://www.mywpexample.com/wp-newsite
但是在数据库和 wordpress 常规设置中我已经:
WordPress Address (URL) -> https://www.mywpexample.com/wp-newsite
Site Address (URL) -> https://www.mywpexample.com/wp-newsite
在 wp-config 文件上:
define('WP_SITEURL', 'https://www.mywpexample.com/wp-newsite' );
define('WP_HOME', 'https://www.mywpexample.com/wp-newsite' );
define('ABSOLUTE_URL', 'www.mywpexample.com/wp-newsite');
如果尝试像 wp-config 那样添加 SSL 选项:
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL', true)
define('FORCE_SSL_LOGIN', true)
站点中断后浏览器显示 TOO_MANY_REDIRECTS
错误。
现在,我已经得到了这个前端解决方案,将根目录中的所有 http --> 替换为 https.. index.php
<?php
ob_start();
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
//and these lines also
$output = ob_get_contents();
ob_end_clean();
$output = str_replace(array("https://", "http://"), "//", $output);
echo str_replace('http:\/\/', "\/\/", $output);
但需要一个更好的解决方案,适用于所有环境(wp-admin、wp-login 和前端)。
嘿,伙计,如果你遇到同样的问题。 "Mixed content blocking"
请使用以下plugin
如果使用 ngnix 服务器,则根据您的服务器建议更改插件设置。
在我的 WordPress 站点中,我在子文件夹中使用另一个 WordPress,例如:https://www.mywpexample.com/wp-newsite
我已经为我的站点设置了 SSL,但突然显示控制台混合内容 https 未加载错误,并且未在站点 css/js/actions 中加载任何资产 (css/js/actions) =14=].
我已经尝试 echo site_url()
它的 return 的 http://www.mywpexample.com/wp-newsite
但是在数据库和 wordpress 常规设置中我已经:
WordPress Address (URL) ->
https://www.mywpexample.com/wp-newsite
Site Address (URL) ->
https://www.mywpexample.com/wp-newsite
在 wp-config 文件上:
define('WP_SITEURL', 'https://www.mywpexample.com/wp-newsite' );
define('WP_HOME', 'https://www.mywpexample.com/wp-newsite' );
define('ABSOLUTE_URL', 'www.mywpexample.com/wp-newsite');
如果尝试像 wp-config 那样添加 SSL 选项:
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL', true)
define('FORCE_SSL_LOGIN', true)
站点中断后浏览器显示 TOO_MANY_REDIRECTS
错误。
现在,我已经得到了这个前端解决方案,将根目录中的所有 http --> 替换为 https.. index.php
<?php
ob_start();
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
//and these lines also
$output = ob_get_contents();
ob_end_clean();
$output = str_replace(array("https://", "http://"), "//", $output);
echo str_replace('http:\/\/', "\/\/", $output);
但需要一个更好的解决方案,适用于所有环境(wp-admin、wp-login 和前端)。
嘿,伙计,如果你遇到同样的问题。 "Mixed content blocking"
请使用以下plugin
如果使用 ngnix 服务器,则根据您的服务器建议更改插件设置。