讓phpcms全站支持https修改教程
時(shí)間:2023-04-24 03:51:02 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)
時(shí)間:2023-04-24 03:51:02 來(lái)源:網(wǎng)站運(yùn)營(yíng)
讓phpcms全站支持https修改教程:程序修改部分
1、修改phpcms/modules/admin/site.php
大約45行和128行的正則
('/http://(.+)/$/i', $domain))
修改為:
('/(http|https)://(.+)/$/i', $domain))
2、修改phpcms/modules/admin/templates/setting.tpl.php大約18行中的正則
http://(.+)1$
修改為:
http[s]?://(.+)1$
3、修改phpcms/modules/admin/templates/site_add.tpl.php大約13行中的正則
http://(.+)/$
修改為:
http[s]?://(.+)/$
4、修改phpcms/modules/admin/templates/site_edit.tpl.php大約11行中的正則
http://(.+)/$
修改為:
http[s]?://(.+)/$
5、修改phpcms/modules/link/templates/link_add.tpl.php大約10行中的正則
^http://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&]
(2)$
修改為:
^http[s]?://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&]
(2)$
6、修改phpcms/modules/link/templates/link_edit.tpl.php大約11行中的正則
^http://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&]
(2)$
修改為:
^http[s]?://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&]
(2)$
7、修改phpcms/modules/link/index.php大約41行和51行中的正則
/http://(.*)/i
修改為:
/^http[s]?://(.*)/i
8、修改phpcmslibsfunctionsglobal.func.php
大約738行的正則
$url = str_replace(array('http://','//','~'), array('~','/','http://'), $url);
修改為
$url = str_replace(array('https://','//','~'), array('~','/','https://'), $url);
9、修改phpcmsmodulescontenttemplatescontent_list.tpl.php
大約97行
elseif(strpos($r['url'],'http://')!==false)
修改為
elseif(strpos($r['url'],'https://')!==false)
10、修改phpcmsmodulescontenttemplatescontent_page.tpl.php
大約28行
if(strpos($category['url'],'http://')===false)
修改為
if(strpos($category['url'],'http://')== =false && strpos($category['url'],'https://')===false)
接著修改后臺(tái)設(shè)置->基本設(shè)置 對(duì)應(yīng)的css、js、圖片、附件的路徑全改為https
還有后臺(tái)設(shè)置-> 站點(diǎn)管理 里面的站點(diǎn)域名http改為https
如果你的網(wǎng)站是使用了https 但是url沒(méi)有顯示綠色的安全 則需要在head頭部代碼 加入
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
最后更新站點(diǎn)首頁(yè),內(nèi)容頁(yè),欄目頁(yè)。