首页 > 解决方案 > 未在 https 中加载的 font-awesome 会在 Web 浏览器控制台中出现错误,但不会在 http 中出现错误?怎么修

问题描述

当我将我的网站 URL HTTP 更改为 https 时,我们将源代码 HTTP 更改为 https 仍然在 chrome 控制台中遇到混合内容错误。这一行写在控制台中:-Mixed Content: The page https://example.com/was loaded over HTTPS but requested an insecure font http://www.example.com/resource/home/new_resources/fonts/font-awesome/fontawesome-webfont.woff2?v=4.7.0。此请求已被阻止;内容必须通过 HTTPS 提供。我的网站使用 Codeigniter 框架、Apache 2.3、mysql 在此处输入图像描述

标签: csscodeigniterhttpsfont-awesomemixed-content

解决方案


将此代码添加到您的.htaccess

RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

base_url然后像这样改变你https://www.yoursite.com


推荐阅读