修改 phpcms\libs\functions\global.func.php
搜索function pageurl
替换原来的代码
$url = str_replace(array('http://','//','~'), array('~','/','http://'), $url);
为
//ASMITA修改
if(substr($url,0,5)=="https"){
$url = str_replace(array('https://','//','~'), array('~','/','https://'), $url);
}
else{
$url = str_replace(array('http://','//','~'), array('~','/','http://'), $url);
}
--------------------------以下为如何配置phpcms v9到https-----------------------------
我只复制了代码修改部分,其他没贴,需要的可以自己去看
原文:http://bbs.phpcms.cn/thread-936379-1-1.html
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:\/\/(.+)[^/]$
修改为
http[s]?:\/\/(.+)[^/]$
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]+[\/=\?%\-&]*([^<>])*$
修改为
^http[s]?:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$
6.修改phpcms/modules/link/templates/link_edit.tpl.php
大约11行中的正则
^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$
修改为
^http[s]?:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$
7.修改phpcms/modules/link/index.php
大约41行和51行中的正则
/http:\/\/(.*)/i
修改为
/^http[s]?:\/\/(.*)/i
--------------另外一篇帖子中需要更正的地方----------------
原文:https://blog.youkuaiyun.com/a1079540945/article/details/79776704
找开 phpcms\modules\admin 下的 site.php文件,在大约128行修改如下:
if (!empty($domain) && !preg_match('/http:\/\/(.+)\/$/i', $domain)) {
修改为
if (!empty($domain) && !preg_match('/https:\/\/(.+)\/$/i', $domain)) {
此处最好修改为
if (!empty($domain) && !preg_match('/http:\/\/(.+)\/$|https:\/\/(.+)\/$/i', $domain)) {