如何让wp将URL包含为HTTPS?

时间:2018-06-30 作者:open source guy

我正在将我的网站从http迁移到https。现在静态文件来自http模式。实例

<script type=\'text/javascript\' src=\'http://demo.com/news/wp-includes/js/comment-reply.min.js?ver=4.9.6\'></script>
<script type=\'text/javascript\' src=\'http://demo.com/news/wp-includes/js/wp-embed.min.js?ver=4.9.6\'></script> 
应该是这样的

 <script type=\'text/javascript\' src=\'https://demo.com/news/wp-includes/js/comment-reply.min.js?ver=4.9.6\'></script>
    <script type=\'text/javascript\' src=\'https://demo.com/news/wp-includes/js/wp-embed.min.js?ver=4.9.6\'></script> 
我补充道

remove_filter(\'template_redirect\', \'redirect_canonical\');
删除重定向,因为它是从aws云端加载的。要从https加载所有css/js,我必须做什么?

1 个回复
SO网友:Leona

这取决于您如何在网站上包含这些脚本。您是否将它们直接包含在主题文件中(即页脚、页眉)或在函数中使用wp\\u enqueue\\u脚本。php?

在第一种情况下,您必须手动将这些脚本URL更新为https,同时请确保您已将WordPress和网站地址更新为https。

结束