font-awesome not working with Apache 2.4.x

隐身守侯 提交于 2019-12-25 06:45:22

问题


When I try to statically use font-awesome (fa) in my project with Apache 2.4.x the icons will not show up. Fa works with apache 2.2.x, and Python's SimpleHHTPServer.

This is not the IE/Firefox issue where a box is displayed instead of the icon.

I am using this in Dreamfactory (OSX), but I have also tried vanilla Apache from MacPorts with the same results.

Chrome's console reports the following when the page loads:

Resource interpreted as Stylesheet but transferred with MIME type text/troff: "http://localhost:8080/files/applications/CADRe/bower_components/font-awesome/css/font-awesome.min.css".

Fa was installed with bower and I am including it like this:

<link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet">

My project also includes angularjs and bootstrap.


回答1:


When you run the DreamFactory admin console, do you see icons? Those use the Bootstrap CDN to serve up font awesome.

This could be an apache config issue , in which case you'd need to edit your apache config to support the mime type:

AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType application/x-font-woff woff

I would put this as a comment, but this is a new account, and I'm disallowed.




回答2:


Add css with full path and above provided add font mytype in either .htaccess or apachec config file

<link href="http://localhost:8080/files/applications/CADRe/bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet">

In .htaccess

AddType application/vnd.ms-fontobject eot
AddType font/truetype ttf
AddType application/x-font-woff woff


来源:https://stackoverflow.com/questions/23721799/font-awesome-not-working-with-apache-2-4-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!