phpcms v9启用ssl之后(https://)后台文章列表404错误及不显示绿色安全等问题的解决

使用phpcms制作的网站,采用全站https:// 也就是SSL之后,会出现一些问题,现集中分享一下解决方案。

第一:后台内容管理文章列表404错误

phpcms v9会出现后台内容管理文章列表分页的404错误,这个需要修改 libs里面的一个文件即可。

打开文件 phpcms\libs\functions \global.func.php ,找到738行的位置:
$url = str_replace(array(‘http://’,’//’,’~’), array(‘~’,’/’,’http://’), url);
修改为即可:
$url = str_replace(array(‘https://’,’//’,’~’), array(‘~’,’/’,’https://’), $url);

第二:明明开启了SSL,但浏览器仍然显示不安全

这里 需要在页面的头部,添加一个meta声明即可完美解决。

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

这个meta的意思是,告诉浏览器,这个页面支持安全SSL协议,可以是用https://传递信息。

第三:会员无法注册等问题

严格按照以下步骤修改后,注册用户 帐号登录等操作完全正常 和PHPSSO通信完全正常,后台添加信息和前台链接URL完全正常

后台输入https的url可通过JS校验部分的修改

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]?:\/\/(.+)[^/]$

修改phpcms/modules/admin/templates/site_add.tpl.php大约13行中的正则

http:\/\/(.+)\/$

修改为

http[s]?:\/\/(.+)\/$

修改phpcms/modules/admin/templates/site_edit.tpl.php大约11行中的正则

http:\/\/(.+)\/$

修改为

http[s]?:\/\/(.+)\/$

修改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]+[\/=\?%\-&]*([^<>])*$

修改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]+[\/=\?%\-&]*([^<>])*$

修改phpcms/modules/link/index.php大约41行和51行中的正则

/http:\/\/(.*)/i

修改为
/^http[s]?:\/\/(.*)/i

Published by 小车

网站技术工人