修改 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
调整方法:
1.修改站点域名,正常情况在站点修改会提示:站点域名格式应该为http://www.phpcms.cn/,请以/结束!
如果不改的话, 咱们站点域名 无法增加成这样:https://www.ympfb.com/
请按照如下方法修改
修改文件:phpcms\modules\admin\site.php文件,大概在138行左右,edit的方法中
if (!empty(KaTeX parse error: Expected 'EOF', got '&' at position 9: domain) &̲& !preg_match('…/i’, $domain)) {
showmessage(L(‘site_domain’).L(‘site_domain_ex2’));
}
2、后台列表地址错误问题:
打开phpcms\modules\content\templates\content_list.tpl.php,大概在99行左右:
strpos($r[‘url’],‘https://’)!==false
将代码里的http 修改为https即可。
3、后台内容列表翻页错误问题:
找到文件:phpcms\libs\functions\global.func.php,找到pageurl方法,大概796行左右,修改下面代码:
$url = str_replace(array(‘https://’,’//’,’~’), array(’~’,’/’,‘https://’), $url);
将这两处代码中的http修改为https即可。
扫一扫程序员咨询
扫一扫官方公众号
网站免费预设计,满意后再签合同,开发票。
程序员接单!无中介费用,纯开发费用,公开透明,中途绝无加价情况
10年的网站开发经验,拥有丰富的网站源代码,快速解决客户网站需求
常年微信售后,当天解决网站出现的各种运维问题,让你的网络营销无后顾之忧。