更改所有出现的"http"到"https"在wordpress页面上 [英] Change all occurrences of "http" to "https" on a wordpress page

查看:281
本文介绍了更改所有出现的"http"到"https"在wordpress页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一些由Wordpress支持的网站页面上实施SSL. 目前,我在受保护的页面上收到混合内容警告-我的自定义主题包括所有页面上出现的许多链接和src属性.链接显示在页眉,页脚,导航(由wordpress函数自动生成)和侧栏(部分来自插件)中.从理论上讲,我可以为受保护的页面编写自定义的页眉和页脚,但是不可能在受保护的页面上使用插件和导航.

I am in the process of implementing SSL on some of my wordpress-powered site's pages. Currently I'm getting mixed content warnings on the secured pages - my custom theme includes a lot of links and src attributes that occur on all pages. Links appear in the header, footer, the navigation (auto generated by wordpress function) and the sidebar (partially from a plugin). While I could theoretically write a custom header and footer for the secured pages, it'd be impossible to use the plugin and the navigation on the secured page.

我整天试图完成的工作是编写一个javascript或jQuery函数,以将通过SSL服务的页面上所有出现的"http"更改为"https".

What I've been trying to accomplish all day is to write a javascript or jQuery function that changes all occurences of "http" to "https" on pages that are served via SSL.

这个问题公然向我展示了我的编码能力的局限性.问题在于最终送达的文档由几个php文件组成,其中一些我控制不了(将不得不修改(A)相当复杂的插件,而(B)我想在将来进行更新) ).正则表达式对我来说仍然是个谜.

This problem blatantly showed me the limits of my coding capacity. Problematic is that the finally served document consists of several php files, some of which I have little control over (would have to modify plugin(s) which are (A) rather complex and (B) I'd like to update in the future). Also regular expressions are still a mystery to me.

我不知道这是否完全可能,用 $(document).ready window.onload 触发更改是否为时不晚无论如何,因为浏览器会在此之前发出混合内容警告.

I don't know if this is at all possible and whether triggering the change with $(document).ready or window.onload wouldn't be too late anyway, since the browser will issue the mixed content warning earlier than that.

谢谢,约翰内斯

推荐答案

我认为您应该使用"WordPress HTTPS"之类的插件.您应该意识到太多的极端情况(例如您无法控制的第三方插件),并且使用像这样稳定运行的插件将是一种有趣的方法.

I think you should use a plugin like "WordPress HTTPS". There are too many edge cases that you should be aware of (like third party plugins you don't have control) and using a well stablished add-on like this one would be an interesting approach.

WordPress HTTPS旨在成为 在SSL上使用SSL的多合一解决方案 WordPress网站.免费支持 提供!

WordPress HTTPS is intended to be an all-in-one solution to using SSL on WordPress sites. Free support provided!

这篇关于更改所有出现的"http"到"https"在wordpress页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆