Fontawesome does not work when served by IIS

后端 未结 10 678
梦谈多话
梦谈多话 2021-01-02 17:10

FontAwesome does not work for me when I put my app on IIS7 server.

In Firefox the requested URL is encoded to http://l2etest.kema.intra/fonts/fontawesome-webfo

相关标签:
10条回答
  • 2021-01-02 17:44

    SquishIt bundling tool for MVC3 was url-encoding the font paths, so ../fonts/fontawesome-webfont.eot? in css file was changed to ../fonts/fontawesome-webfont.eot%3F. This normally returns 400, because %3F is considered unsafe. If you set requestPathInvalidCharacters="" then %3F is considered safe, but there is obviously no file ``../fonts/fontawesome-webfont.eot%3F`, therefore 404.

    I removed fontawesome.css from the bundle and everything works fine.

    0 讨论(0)
  • 2021-01-02 17:44

    for me only adding the bootstrap CDN link solved the issue

    for your page:

    <head>
    ...
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    ...
    </head>
    
    0 讨论(0)
  • 2021-01-02 17:46

    Why is @font-face throwing a 404 error on woff files?

    Add the MIME types in the web config:

      <system.webServer>
        <staticContent>
          <remove fileExtension=".woff" /> <!-- In case IIS already has this mime type -->
          <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
        </staticContent>    
      </system.webServer>
    
    0 讨论(0)
  • 2021-01-02 17:54

    If you are using CodeIgniter under IIS7 :

    In your web.config file, add woff to the pattern

    <rule name="Rewrite CI Index"> <match url=".*" /> <conditions> <add input="{REQUEST_FILENAME}" pattern="css|js|jpg|jpeg|png|gif|ico|htm|html|woff" negate="true" /> </conditions> <action type="Rewrite" url="index.php/{R:0}" /> </rule>

    Hope it helps !

    0 讨论(0)
提交回复
热议问题