技錄生活

了解行業(yè)最新資訊,把握市場動態(tài)。

讓phpcms支持https

發(fā)布日期:2024-06-14; 點擊率:1708; 來源:太倉蘇易

1、修改phpcms/modules/admin/site.php  大約45行和128行的正則

if (!empty($domain) && !preg_match('/http://(.+)/$/i', $domain)) {

修改為:

if (!empty($domain) && !preg_match('/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、修改phpcms/libs/functions/global.func.php

大約738行的正則

$url = str_replace(array('http://','//','~'), array('~','/','http://'), $url);

修改為

$url = str_replace(array('https://','http://','//','~','~'), array('~','~','/','https://','http://'), $url);

//$url = str_replace(array('https://','//','~'), array('~','/','https://'), $url);

9、修改phpcms/modules/content/templates/content_list.tpl.php

大約97行

elseif(strpos($r['url'],'http://')!==false)

修改為

elseif(strpos($r['url'],'http://')!==false||strpos($r['url'],'https://')!==false)

10、修改phpcms/modules/content/templates/content_page.tpl.php

大約28行

if(strpos($category['url'],'http://')===false)

修改為

if(strpos($category['url'],'http://')===false && strpos($category['url'],'https://')===false)

接著修改后臺設置->基本設置 對應的css、js、圖片、附件的路徑全改為https

還有后臺設置-> 站點管理 里面的站點域名http改為https

如果你的網(wǎng)站是使用了https 但是url沒有顯示綠色的安全 則需要在head頭部代碼 加入

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />

最后更新站點首頁,內(nèi)容頁,欄目頁。

上一篇注重細節(jié)的網(wǎng)站制作:提升用戶體驗,彰顯企業(yè)實力

下一篇優(yōu)化運維支持效果的自動化工具與腳本

返回頂部