Types 资源被解释为字体,但使用MIME类型text/html进行传输赢得';不固定

Types 资源被解释为字体,但使用MIME类型text/html进行传输赢得';不固定,types,mime,Types,Mime,我正在尝试解决Chrome警告: Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.woff". index.php:195 Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fo

我正在尝试解决Chrome警告:

Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.woff". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.woff". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.ttf". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.ttf". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.svg". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.svg". index.php:195
资源解释为字体,但使用MIME类型text/html传输

我想这会妨碍我正确加载字体。我将此代码用于css:

@font-face {
    font-family: 'stereofidelic';
    src: url('/css/fonts/stereofidelic.eot'); /* IE9 Compat Modes */
    src: url('/css/fonts/stereofidelic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/css/fonts/stereofidelic.woff') format('woff'), /* Modern Browsers */
         url('/css/fonts/stereofidelic.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/css/fonts/stereofidelic.svg#svgFontName') format('svg'); /* Legacy iOS */
    }
@font-face {
    font-family: 'bebasneue';
    src: url('/css/fonts/BebasNeue.eot'); /* IE9 Compat Modes */
    src: url('/css/fonts/BebasNeue.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/css/fonts/BebasNeue.woff') format('woff'), /* Modern Browsers */
         url('/css/fonts/BebasNeue.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/css/fonts/BebasNeue.svg#svgFontName') format('svg'); /* Legacy iOS */
    }
@font-face {
    font-family: 'karamuruh';
    src: url('/css/fonts/karamuruh.eot'); /* IE9 Compat Modes */
    src: url('/css/fonts/karamuruh.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/css/fonts/karamuruh.woff') format('woff'), /* Modern Browsers */
         url('/css/fontsh/karamuruh.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/css/fonts/karamuruh.svg#svgFontName') format('svg'); /* Legacy iOS */
    }
@font-face {
    font-family: 'comicnotesmooth';
    src: url('/css/fonts/comicnotesmooth.eot'); /* IE9 Compat Modes */
    src: url('/css/fonts/comicnotesmooth.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/css/fonts/comicnotesmooth.woff') format('woff'), /* Modern Browsers */
         url('/css/fonts/comicnotesmooth.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/css/fonts/comicnotesmooth.svg#svgFontName') format('svg'); /* Legacy iOS */
    }
@font-face {
    font-family: 'singlesleeve';
    src: url('/css/fonts/singlesleeve.eot'); /* IE9 Compat Modes */
    src: url('/css/fonts/singlesleeve.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/css/fonts/singlesleeve.woff') format('woff'), /* Modern Browsers */
         url('/css/fonts/singlesleeve.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/css/fonts/singlesleeve.svg#svgFontName') format('svg'); /* Legacy iOS */
    }        
@font-face {
    font-family: 'TravelingTypewriter';
    src: url('/css/fonts/TravelingTypewriter.eot'); /* IE9 Compat Modes */
    src: url('/css/fonts/TravelingTypewriter.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/css/fonts/TravelingTypewriter.woff') format('woff'), /* Modern Browsers */
         url('/css/fonts/TravelingTypewriter.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/css/fonts/TravelingTypewriter.svg#svgFontName') format('svg'); /* Legacy iOS */
    }  
我试图在.htaccess中添加任何类型的指令,通过谷歌搜索,我发现许多人的解决方案是在.htaccess中添加以下内容:

AddType application/vnd.ms-fontobject .eot
AddType application/octet-stream .otf .ttf
AddType font/otf .otf
AddType font/opentype .woff
但我仍然从Chrome得到同样的警告:

Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.woff". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.woff". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.ttf". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.ttf". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.svg". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.svg". index.php:195
在我的本地Web服务器上,一切正常,我不需要在.htaccess中添加任何AddType指令

stackoverflow.com上建议的解决方案需要24小时的谷歌搜索和尝试,但运气不佳


有什么帮助吗?

如果你有mod rewrite,你应该设置如下规则:

RewriteEngine On
RewriteRule !(\.ico\.gif|\.png|\.jpe?g|\.css|\.js|\.php|\.eot|\.svg|\.ttf|\.woff|\.otf|^public/.*)$ index.php [nocase,last]

我使用Apache。

部分解决了:将规则重写为。htaccess做出了一个令人讨厌的行为。我更改了一些规则,现在字体在Chrome中工作,但在Firefox中不工作