2014-10-02 08:37
浏览 121


I have come across an error when trying to access my site with http://www.example.com instead of http://eample.com. My font icons will not load. So when searching for the solution to this I came across the following solution which was adding the below code to a .htaccess file on the server.

<FilesMatch "\.(svg|ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "http://example.com, http://www.example.com"

This managed to fix the problem but for Chrome only. How can i fix the issue for all browsers.

Thank you

图片转代码服务由CSDN问答提供 功能建议

尝试使用 http://www.example.com 而不是 http:// eample。 COM 。 我的字体图标无法加载。 因此,在搜索解决方案时,我遇到了以下解决方案:将以下代码添加到服务器上的.htaccess文件中。

 &lt; FilesMatch“\。  (svg | ttf | otf | eot | woff)$“&gt; 
&lt; IfModule mod_headers.c&gt; 
标题集设置Access-Control-Allow-Origin”http://example.com,http://www.example  .com“
&lt; / IfModule&gt; 

这设法解决了问题,但仅适用于Chrome。 如何解决所有浏览器的问题。


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doubleyou1001 2014-10-02 08:48

    Try using:


    This will be relative to the domain they visitor is on, so if they connect to either http:// or http://www the fonts will load and there won't be a cross domain error

    点赞 评论

相关推荐 更多相似问题