Adding custom MIME types to web.config in IIS7 with Go Daddy

Standard

For a few months I’ve been having issues with certain files on my Go Daddy web host.  I would upload them and then try to access them and I would get the dreaded default “Oops! Page not found” error.

After searching the Go Daddy community forums and some Microsoft IIS sites I realized that IIS7 does not serve up files with extensions it doesn’t know what to do with.  This is done for security reasons so that people cant hit your web.config file, or maybe an access database file (.mdb).

To get around this you can add custom MIME types to the IIS 7.0 manager but what if you don’t have access to this?  For example if you are on a shared web host account with Go Daddy and all you have is FTP access and web site control panel options which are limited.

The answer is to add some code to your web.config file to allow your site to recognize these different file extensions and pass the proper information in the header to the browser.

The code is very simple, just make sure you put it in the right place or you will break your entire website.  Backup your web.config file first if you have never modified it before.

Here is some sample code for adding the file types .m4v, .ogg, .oga, .ogv, and .webm.

NOTE: When I tried to add .mp4 to my list it caused the server to return an unknown error, I suspect maybe its because Go Daddy has mp4 already included on their list (see link below) I don’t know, but regardless mp4 caused my site to crash, everything else works fine.

<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
            <mimeMap fileExtension=".ogg" mimeType="audio/ogg" />
            <mimeMap fileExtension=".oga" mimeType="audio/ogg" />
            <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
            <mimeMap fileExtension=".webm" mimeType="video/webm"/>
        </staticContent>
    </system.webServer>
</configuration>

If you already have a web.config file you probably already have the system.webServer section. don’t add a second one just put the staticContent section inside the webServer section.

For more information see the IIS blog post and Go Daddy mime type listing url’s I found along the way.

http://blogs.iis.net/bills/archive/2008/03/25/how-to-add-mime-types-with-iis7-web-config.aspx
http://community.godaddy.com/help/article/3821

Advertisements

3 thoughts on “Adding custom MIME types to web.config in IIS7 with Go Daddy

  1. ankit

    I have same problem on my godaddy’s shared hosting account but I ‘ve tried all your suggestion but I am unable to see my website stats as page not found error is there….stats contain only .html file so I add mime type html but doing this on web.config resulting an error

  2. I tried to put an epub file up on my GoDaddy server and get the 404 error. This is a eBook format that I want downloadable from the web site. I don’t know what to type in to the MIME types list. text/file.epub is called invalid. Ideas?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s