virtuti-d

Sep 17
2013

Godaddy and MIME types

GoDaddy, where enormous amount of websites is hosted, has many faults. One of them is non-support of many file formats, codecs and so on–what is called MIME types. I am not going to talk about custom MIME types, but about stabile, existing ones only, which GoDaddy nonetheless, refuses to support (and God knows why). However, there is pretty simple workaround. All we need is to add custom file with necessary information. The file is called web.config. Below I shall show how to create this specific file and add information into there in order to force GoDaddy to support certain MIME types. I am talking below only about Windows server. For Linux server another type of file should be created.

So, let’s say we want to add native HTML5 audio player. All is fine with mp3 codec but ogg codec will never play if your website is hosted by GoDaddy on Windows server. So, in order to provide working i.e. playing track for all browsers we need to create not only mp3 file but its .ogg extension fallback as well. Now, we need to force GoDaddy to play it. For this, we need to create a blank file, entitle it web.config and upload to the root folder. Here is a screenshot from Filezilla, on the right side you see web.config file uploaded to the root folder:

config

Before you upload the file to your root folder, naturally you need to add certain information–actually a piece of code which will force GoDaddy to understand what you want. Copy and paste next piece of code into web.config:

<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
</staticContent>
</system.webServer>
</configuration>

That’s it, actually all is done. Of course, you may add multiple MIME types. Just repeat the line starting with mimeMap fileExtension… and insert another type (video for example) and file extension, (mpg4 for example). Here is example of multiple extensions in web.config file:

<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
</staticContent>
</system.webServer>
</configuration>
Tags: