WWW FAQs: How do I add a MIME content type to my web server?

2006-05-31: When a web server sends a page, image or other object to a web browser, the browser doesn't try to guess what kind of object it is. Instead, the browser looks at the MIME content type header sent by the server. This is a good thing, because only the webmaster who set up the server knows what the object is!

There's one time, though, when this can be a pain: sometimes the web server hasn't been configured to know about a MIME type, especially if it is for a recently invented file format.

To see an example of how to correct this problem for Windows Media files, and to learn about mime type configuration in general, check out Microsoft's content hosting and deploying pages, which offer a complete guide to configuring common web servers (yes, including both Apache and IIS) to recognize Windows Media mime types. The advice given there is also useful for configuring servers to map other file extensions to other mime types, such as audio/mpeg for .mp3 files and audio/x-pn-realaudio for .ram, .rm, and .ra files.

If you are not the web server administrator, ask your web server administrator to do these steps for you. If they are not cooperative -- which they should be -- there is an easy workaround if you are permitted to run CGI scripts. See MimeSlapper for more information.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!