configure mime types windows azure websites php app

一世执手 提交于 2019-12-06 21:19:04

问题


I'm using Windows Azure Websites to host a php app. My app uses webfonts (css3 feature) and I need to configure extensions such as .eot; .woff to avoid 404 errors. I know that it's possible to set this kind of configs using web.config in a .net app, but for a php site, what can I do? Unfortunately there's no RDP for websites. Is there another way to solve this?


回答1:


I could solve this just adding a web.config to root folder.

<?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:


For anyone coming here, I also hade the problem with woff2 files and got rid of the errors by adding this web.config file to the root:

<?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>

By using the kudu service to add the file to the wwwroot directory as described here: http://www.jamessturtevant.com/posts/How-to-add-edit-and-remove-files-in-your-azure-webapp-using-the-kudu-service-dashboard/



来源:https://stackoverflow.com/questions/20663535/configure-mime-types-windows-azure-websites-php-app

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