phpcms v9.6建设的网站,安装ssl开启https访问后图片素材不显示,怎么办呢?正常如果http和https都开启的话,会有一部分素材正常,但是如果强制只允许https访问,就会导致样式和图片素材都不显示了。原因是phpcms系统中很多路径都是写死的http访问方式,这里我们需要修改phpcms程序几处,把https加入进去就可以了。
具体请修改下面几处地方:
站点根目录/caches/configs/system.php里的所有http都改成https,如下图:
站点根目录/phpcms/modules/admin/site.php中:
原 ('/http:\/\/(.+)\/$/i', $domain)) 改为 ('/(http|https):\/\/(.+)\/$/i', $domain))
站点根目录/phpcms/modules/admin/templates/setting.tpl.php文件中:
原 http:\/\/(.+)[^/]$ 改为 http[s]?:\/\/(.+)[^/]$
站点根目录/phpcms/modules/admin/templates/site_add.tpl.php文件中:
原 http:\/\/(.+)\/$ 改为 http[s]?:\/\/(.+)\/$
站点根目录/phpcms/modules/admin/templates/site_edit.tpl.php文件中:
原 http:\/\/(.+)\/$ 改为 http[s]?:\/\/(.+)\/$
站点根目录/phpcms/modules/link/index.php文件中:
原 /http:\/\/(.*)/i 改为 /^http[s]?:\/\/(.*)/i
站点根目录/phpcms/modules/link/templates/link_edit.tpl.php文件中:
原 ^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$ 改为 ^http[s]?:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&]*([^<>])*$
完成以上步骤后,请强制https访问,然后后台生成更新下首页,栏目页,内容页和全站缓存看看,是不是好了。
如果内容有帮助,就点个赞吧!