In the following sections, you will learn how to set up MIME types with Apache, Tomcat and Microsoft IIS.


5. Setting up MIME Types with Apache

In Apache, the mappings between MIME types and file extensions are stored in the configuration file apache_home/conf/mime.types, where apache_home is the path under which Apache was installed on your server.

To set up MIME types, open the mime.types file. Lines that begin with the # character are comments and they will be ignored by Apache. Each of the other lines begins with a MIME type, then follows by one or more file extensions. It has the following form:


mimeType fileExtension1 fileExtension2 fileExtension3 ...


Here are some examples:


text/html html htm
application/vnd.wap.xhtml+xml xhtml
text/vnd.wap.wml wml
text/vnd.wap.wmlscript wmls
image/vnd.wap.wbmp wbmp


6. Setting up MIME Types with Tomcat

In Tomcat 5.x and 4.x, the default mappings between MIME types and file extensions are stored in the file tomcat_home/conf/web.xml, where tomcat_home is the path under which Tomcat was installed on your server. The mappings specified there are applied to all web / WAP applications hosted on your Tomcat server. Application-specific mappings should be set in the WEB-INF/web.xml file under the directory of your web / WAP application.

Each mapping is specified with the <mime-mapping>, <extension> and <mime-type> tags. Here is an example:


<web-app>

...

  <mime-mapping>
    <extension>xhtml</extension>
    <mime-type>application/vnd.wap.xhtml+xml</mime-type>
  </mime-mapping>

  <mime-mapping>
    <extension>wml</extension>
    <mime-type>text/vnd.wap.wml</mime-type>
  </mime-mapping>

  <mime-mapping>
    <extension>wmls</extension>
    <mime-type>text/vnd.wap.wmlscript</mime-type>
  </mime-mapping>

  <mime-mapping>
    <extension>wbmp</extension>
    <mime-type>image/vnd.wap.wbmp</mime-type>
  </mime-mapping>

...

</web-app>


7. Setting up MIME Types with Microsoft IIS

Microsoft IIS provides a GUI for setting up MIME types. Below lists the steps for setting up MIME types with IIS 5.0 on Microsoft Windows 2000 Professional:

  1. Bring up the Internet Information Services window by selecting Control Panel -> Administrative Tools -> Internet Service Manager.

  2. In the tree on the left-hand side, you should see an item whose caption is your computer's name. Right-click on it to pop up a menu.

  3. Click Properties in the menu to bring up the Properties window.

  4. Click the Edit button located in the Computer MIME Map frame to bring up the File Types window.

  5. In the File Types window, you can see a list of MIME mappings. Use the buttons labeled "New Type...", "Remove" and "Edit..." to make any changes you want.


The steps for setting up MIME types with other versions of IIS should be similar.

If your IIS is of version 3.0 or below, the procedure is less user-friendly. It involves editing the registry at the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\InetInfo\Parameters\MimeMap. Please refer to other sources for the details.


Previous Page Page 4 of 13 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page