php - 转换为 HTTPS

标签 php html security http https

我有一个 https 站点,谷歌在顶部显示带有黄色三角形的锁,意思是:

The site uses SSL, but Google Chrome has detected insecure content on the page. Be careful if you’re entering sensitive information on this page. Insecure content can provide a loophole for someone to change the look of the page.

我想更改我的站点以使其完全安全并且我获得了绿锁。但是,当我尝试像 https://www.domain.com 而不是 http://www.domain.com 这样通过 https 访问我的页面时,大多数事情都没有工作。 Chrome 的检查员会说这样的话:

The page at https://www.domain.com/Folder/ displayed insecure content from http://website.com/media/images/photo.jpg.

这仅仅是因为我从中获取照片的页面是 http 吗?我应该采取哪些步骤来开始将我的整个网站转换为 https(就更改代码而言)?

最佳答案

@理查德

据我从你的问题中了解到,你可能有指向外部资源的链接,这些资源是从 http://... 而不是 https://... 加载的,只需识别所有这些资源(即图像、样式表、javascript CSS 中的文件甚至图像)并将协议(protocol)部分“http://”替换为“//”。请参见下面的示例:

如果你有:

<img src="http://domain.com/path/to/image.png">

替换为:

<img src="//domain.com/path/to/image.png">

这种方式浏览器将替换适当的协议(protocol)并相应地从 https://或 http://加载资源。

关于php - 转换为 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13103707/

相关文章:

jquery - 文档就绪时的 CSS3 触发鼠标悬停状态

html - 列表项的备用背景颜色

javascript - 服务器上可编辑文件的安全性

php - 代码点火器+哎呀

javascript - PHP:如何正确回显类和 id 以供 jQuery 呈现

jquery - 当所有具有所需类的字段都已填充时,如何动态地将类切换到 div?

wordpress - 为什么我在 wordpress 页面上的 firefox 中连接不安全

java - 禁用文件打开和预览的文件浏览器是否可以免受在资源管理器中查看时运行的恶意软件的侵害?

php - C++、Qt 将数据放入Mysql数据库: through PHP script OR directly from the program

php - 类只包含静态函数,适用哪种设计模式?