一般来说现在很少远程centOS桌面或者是window桌面后台操作了,因为现在有很多类似宝塔的免费管理软件,相对于不熟悉linux命令操作的小伙伴是一种福音,不过大家如果考虑进入SEO或者做php大佬级开发,至少还是的会linux操作,毕竟当下linux功能太强大,现在百分70-90的应用底层都是linux。多的话,不说了,我们来看看怎么去配置https全站:
1、 phpcms/modules/admin/site.php
<!--(大约在128行左右)-->
if (!empty($domain) && !preg_match('/http:\/\/(.+)\/$/i', $domain)) {
showmessage(L('site_domain').L('site_domain_ex2'));
}
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
修改为:(这个修改其实就是修改后台站点限制)
if (!empty($domain) && !preg_match('/https:\/\/(.+)\/$/i', $domain)) {
showmessage(L('site_domain').L('site_domain_ex2'));
}
2、 phpcms/modules/admin/templates/setting.tpl.php
<!--(大约在20行左右)-->
regexValidator({regexp:"http:\/\/(.+)[^/]$",onerror:"<?php echo L('setting_phpsso_type')?>"});
修改为:
regexValidator({regexp:"https:\/\/(.+)[^/]$",onerror:"<?php echo L('setting_phpsso_type')?>"});
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
3、 phpcms/modules/admin/templates/site_add.tpl.php
<!--(大约在11行左右)-->
.regexValidator({regexp:"http:\/\/(.+)\/$",onerror:"<?php echo L('site_domain_ex2')?>"});
修改为:
.regexValidator({regexp:"https:\/\/(.+)\/$",onerror:"<?php echo L('site_domain_ex2')?>"});
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
4、 phpcms/modules/link/templates/link_add.tpl.php
<!--(大约在10行左右)-->
regexValidator({regexp:"^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$
修改为:
<!--(大约在10行左右)-->
regexValidator({regexp:"^https:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
5、 phpcms/modules/link/index.php
<!--(大约在41行左右)-->
if($_POST['url']=="" || !preg_match('/^http:\/\/(.*)/i', $_POST['url'])){
showmessage(L('siteurl_not_empty'),"?m=link&c=index&a=register&siteid=$siteid");
}
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
修改为:
if($_POST['url']=="" || !preg_match('/^https:\/\/(.*)/i', $_POST['url'])){
showmessage(L('siteurl_not_empty'),"?m=link&c=index&a=register&siteid=$siteid");
}
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
<!--(大约在51行左右)-->
if(!preg_match('/^http:\/\/(.*)/i', $logo)){
$logo = '';
}
修改为:
if(!preg_match('/^https:\/\/(.*)/i', $logo)){
$logo = '';
}
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
6、 phpcms\libs\functions\global.func.php (修改翻页出现的错误)
<!--(大约在708行左右)-->
$url = str_replace(array('https://','//','~'), array('~','/','https://'), $url);
修改为:
<!--(大约在708行左右)-->
$url = str_replace(array('https://','//','~'), array('~','/','https://'), $url);
<!—www.ctvol.com _猴子学习网_分享各种技术需求-->
以上就是大部分地方,猴子在修改的时候,是发现有几个地方还有的,但是就不一一的查询了,也就是这几个文件里面,小伙伴在这几个文件中多ctrl+f几次就能看到,不是说没有全举出来,有些小伙伴的模板代码有差异,所以不敢肯定模板是否完全相同。只要是查询到的是正切法则中出现的http就修改成https。
友情提示:这样的设置适合新网站,如果是老站phpcms模板的话,最好就修改上面的提到的就可以了,其他的在数据库里面太多了,新站还可以用sql命令来做,如果是大批量修改的话比较麻烦。
该文章属于:计算机技术网原创
转载请注明标题:phpcms模板安装好ssl后,如何全站https://!-计算机技术网
转载请注明出处:https://www.ctvol.com/seoomethods/2124.html