In the following sections, you will learn how to set up
MIME types with Apache, Tomcat and Microsoft IIS.
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
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>
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:
Bring
up the Internet Information Services window by selecting
Control Panel ->
Administrative Tools
-> Internet Service Manager.
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.
Click
Properties in the
menu to bring up the Properties
window.
Click
the Edit button
located in the Computer MIME Map
frame to bring up the File Types
window.
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.
Feedback Form (ExpandCollapse)
|
|