3.5 Managing MIME Types

Multipurpose Internet Mail Extension (MIME) is a specification used to identify a file type by its extension so that when Apache receives a request for a file, it knows how to handle the file. A list of MIME types that Apache already knows about is included in the conf/mime.types file.

The Global MIME Types page saves you the trouble of manually entering a new MIME type or modifying an existing one. MIME types created on the Global MIME Types page are not added to the conf/mime.types file, but are listed in the httpd.conf file under the AddType directive.

Figure 3-4 Apache Global Mime Types

MIME Types page

MIME types added to the httpd.conf file override MIME types of the same name that already exist in the mime.types file.

Files can have more than one extension and their order does not usually matter. For example, if the extension .rus maps to Russian and HTML maps to HTML, then the files text.rus.html and text.html.rus are treated alike.

However, unrecognized extensions, such as .xyz, wipe out all extensions to their left. Therefore, text.rus.xyz.html is treated as HTML but not as Russian.

HINT:If you will be downloading NetWare Loadable Module™ (NLM™) applications to your Web server, you might want to add NLM as a MIME type. If you do, use application/octet-stream as the content type and .nlm as the suffix.

To create a new MIME type:

  1. From the MIME Types page in Apache Manager, specify a name in the Content Type field that describes the new MIME type.

  2. Specify the character extension in the Suffix field, by typing a period, followed by letters or numbers.

  3. Click New Type.

To edit an existing MIME type:

  1. From the MIME Types page in Apache Manager, locate the MIME type to be edited or removed.

  2. Click Edit and make the required changes to the Content Type and Suffix fields.

  3. Click Edit Type.

  4. Click Save > Save to save your changes.

    or

    Click Save > Save and Apply to save your changes and restart Apache so your changes are immediately put into effect.

    For information about where configuration information is stored, see Section 2.3.3, Saving Configuration Changes and Restarting Apache in Apache Manager.

3.5.1 Default MIME Types

When a document is sent to a client, the server includes a section that identifies the document's type, so the client can present the document in the correct way. However, sometimes the server can't determine the proper type for the document because the document's extension is not defined for the server. In those cases, a default value is sent.

The default is usually Text/Plain, but you should set it to the type of file most commonly stored on your server. Some common MIME types include the following:

text/plain

text/html

text/richtext

image/tiff

image/jpeg

image/gif

application/x-tar

application/postscript

application/x-gzip

audio/basic

For more information about MIME types, see Content Negotiation on the Apache Web site.