2013-12-18 28 views
11

我正在使用Windows Azure網站託管一個PHP應用程序。我的應用程序使用webfonts(css3功能),我需要配置擴展名,例如.eot; .woff以避免404錯誤。我知道可以在.net應用程序中使用web.config設置這種配置,但對於php站點,我該怎麼辦?不幸的是,沒有RDP的網站。有沒有解決這個問題的另一種方法?配置MIME類型窗口天藍色的網站php應用程序

回答

26

我可以解決這只是添加一個web.config到根文件夾。

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.webServer> 
     <staticContent> 
      <remove fileExtension=".woff" /> 
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> 
      <remove fileExtension=".ttf" /> 
      <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" /> 
      <remove fileExtension=".svg" /> 
      <mimeMap fileExtension=".svg" mimeType="image/svg+xml" /> 
     </staticContent> 
    </system.webServer> 
</configuration> 
+2

在對woff的mime類型產生了很多混淆之後,官方[W3規範](http://www.w3.org/TR/WOFF/#appendix- b)聲明它應該是「application/font-woff」而沒有「x-」。 –

+1

這也適用於我與Windows Azure網站! – Simon

+0

這真的幫助我,謝謝! –

0

對於任何人來到這裏,我也woff2文件哈德的問題,並得到了由添加此web.config文件的根擺脫錯誤的:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.webServer> 
     <staticContent> 
      <remove fileExtension=".woff" /> 
      <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" /> 
      <remove fileExtension=".woff2" /> 
      <mimeMap fileExtension=".woff2" mimeType="font/woff2" /> 
     </staticContent> 
    </system.webServer> 
</configuration> 

通過使用捻服務將文件添加到wwwroot目錄中,如下所述: http://www.jamessturtevant.com/posts/How-to-add-edit-and-remove-files-in-your-azure-webapp-using-the-kudu-service-dashboard/

相關問題