黑帽联盟
标题:
让phpcms全站支持https修改教程
[打印本页]
作者:
yun
时间:
2018-5-13 21:18
标题:
让phpcms全站支持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:\/\/(.+)[^/]$
复制代码
修改为:
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
复制代码
8、修改
phpcms\libs\functions\global.func.php
大约738行的正则
$url = str_replace(array('http://','//','~'), array('~','/','http://'), $url);
复制代码
修改为
$url = str_replace(array('https://','//','~'), array('~','/','https://'), $url);
复制代码
9、修改
phpcms\modules\content\templates\content_list.tpl.php
大约97行
elseif(strpos($r['url'],'http://')!==false)
复制代码
修改为
elseif(strpos($r['url'],'https://')!==false)
复制代码
10、修改
phpcms\modules\content\templates\content_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头部代码 加入
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
复制代码
最后更新站点首页,内容页,栏目页。
站点原创,转载请附上转载地址
欢迎光临 黑帽联盟 (https://bbs.cnblackhat.com/)
Powered by Discuz! X2.5