在当前使用主题文件:function.php 加入以下代码
add_filter('get_header', 'fanly_ssl');
function fanly_ssl(){
if( is_ssl() ){
function fanly_ssl_main ($content){
$siteurl = get_option('siteurl');
$upload_dir = wp_upload_dir();
$content = str_replace( 'http:'.strstr($siteurl, '//'), 'https:'.strstr($siteurl, '//'), $content);
$content = str_replace( 'http:'.strstr($upload_dir['baseurl'], '//'), 'https:'.strstr($upload_dir['baseurl'], '//'), $content);
return $content;
}
ob_start("fanly_ssl_main");
}
}
wp-config.php 文件中添加:
define('FORCE_SSL_ADMIN', true);
define('FORCE_SSL_LOGIN', true);
新建 「.htaccess」 添加伪静态规则:
RewriteCond %{HTTPS} !on [NC]
RewriteRule (.*) https://域名%{REQUEST_URI} [R=301,NC,L]








![[奇葩一说]小仙女擦碰新车反手殴打辱骂车主](http://www.xyok.net/wp-content/uploads/2025/11/QQ_1764413294495-75x75.png)















