linux - 字体图标在网页中不显示的问题。
本文介绍了linux - 字体图标在网页中不显示的问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
1.在我输入我的服务器地址的时候出来的网页是这样的
2.但是当我用我的域名访问的时候就变成这样子了
百度之后我发现应该是所谓的跨域的问题,我用的ubuntu的服务器,web服务器是apache2,用网上提供的办法都不行,请问各位大牛该如何解决???
(index):1 Font from origin 'http://182.254.246.42' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.futuinfi.cn' is therefore not allowed access.
解决方案
/etc/apache2/httpd.conf
<Directory />
# Add the following line to enable CORS to connect to local elasticsearch.
Header set Access-Control-Allow-Origin "*.futuinfi.cn"
AllowOverride none
Require all denied
</Directory>
这个回答时间较新
打开.htaccess
# ----------------------------------------------------------------------
# Allow loading of external fonts
# ----------------------------------------------------------------------
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
SetEnvIf Origin "http(s)?://(www\.)?(futuinfi.cn)$" AccessControlAllowOrigin=$0
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
</IfModule>
</FilesMatch>
这篇关于linux - 字体图标在网页中不显示的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文