PHPCMS开发

当前位置/ 首页/ V9教程/PHPCMS开发/ 正文

PHPCMS v9支持HTTPS的方法

PHPCMS v9支持HTTPS的方法

一.安装部分

首先配置好你主机的SSL证书,我是强制HTTPS访问,http访问会301跳转到HTTPS,确保以下安装过程全部在https下的地址安装

linux系统下上传V9所有文件后设置

cache

uploadfile

phpsso_server/cache

phpsso_server/uploadfile

四个文件夹权限为777

然后开始安装

安装后登录后台更新缓存
 

二.程序修改部分

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

修改phpcms/modules/admin/site.php

大约45行和128行的正则(注意有两处都要改)

​('/http:\/\/(.+)\/$/i', $domain))


修改为:

('/(http|https):\/\/(.+)\/$/i', $domain))

修改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



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

原文:修改PHPCMS v9.6.3 让其支持HTTPS