使用騰訊雲CDN作HTTPS的WordPress博客時要改的代碼php
編輯打開網站根目錄下的文件wp-settings.php網站
在最頂部的<?php下面一行,添加如下代碼spa
if(!empty($_SERVER['HTTP_X_FORWARDED_PROTO']))$_SERVER['REQUEST_SCHEME']=$_SERVER['HTTP_X_FORWARDED_PROTO']; if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))$_SERVER['REMOTE_ADDR']=trim(explode(',',$_SERVER['HTTP_X_FORWARDED_FOR'])[0]); if($_SERVER['REQUEST_SCHEME']==='https')$_SERVER['SERVER_PORT']=443;