我有一个 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/