Allow A New Mime Type Download on WordPress / Azure

After you allow a new MIME type via editing your functions.php file or using a plugin like WP Add Mime Types, you might find that you can’t download the files when running WordPress on Microsoft Azure.

I ran into this problem recently when adding .gpx and .kml files to my site, but you could encounter similar problems with other types. The error message I was getting when attempting to download the files in a browser was:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

The problem is that by default, WordPress runs under Microsoft Windows in Microsoft Azure, but IIS does not serve many types of static content by default. The easiest solution, other than trying to modify the configuration for IIS, itself, is to modify the Web.config file for the web application. In the root of your WordPress application folder, you’ll either see no Web.config file (you can use the first example below as a full file), or you’ll see an existing Web.config file you can modify.

The following piece should allow you to download the files you want (adjust for the types of file extensions and MIME types you’re attempting to allow):

My site already had a Web.config file with a rewrite rule, so I actually modified it to be similar to the below example (the name portion is a placeholder):