phpcms v9全站支持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)

接着修改后台设置->基本设置 对应的css、js、图片、附件的路径全改为https
还有后台设置-> 站点管理 里面的站点域名http改为https

如果你的网站是使用了https 但是url没有显示绿色的安全 则需要在head头部代码 加入

最后更新站点首页,内容页,栏目页。

最后修改:2022 年 09 月 21 日
如果觉得我的文章对你有用,请随意赞赏