Module mod_mime

This module is contained in the mod_mime.c file, and is compiled in by default. It provides for determining the types of files from the filename.

Summary

This module is used to determine the mime types of documents. Some mime types indicate special processing to be performed by the server, otherwise the type is returned to the client so that the browser can deal with the document appropriately.

The filename of a document is treated as being composed of a basename followed by some extensions, in the following order:

base.type.language.enc
The type extension sets the type of the document; types are defined in the TypesConfig file and by the AddType directive. The language extension sets the language of the document, as defined by the AddLanguage directive. Finally, the enc directive sets the encoding of the document, as defined by the AddEncoding directive.

Directives


AddEncoding

Syntax: AddEncoding mime-enc extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime

The AddEncoding directive adds to the list of filename extensions which filenames may end in for the specified encoding type. Mime-enc is the mime encoding to use for documents ending in extension. Example:

AddEncoding x-gzip gz
AddEncoding x-compress Z
This will cause files ending in .gz to be marked as encoded using the x-gzip encoding, and .Z files to be marked as encoded with x-compress.


AddLanguage

Syntax: AddLanguage mime-lang extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime

The AddLanguage directive adds to the list of filename extensions which filenames may end in for the specified content language. Mime-lang is the mime language of files with names ending extension, after any content encoding extensions have been removed. Example:

AddEncoding x-compress Z
AddLanguage en .en
AddLanguage fr .fr
Then the document xxxx.en.Z will be treated as being a compressed English document. Although the content language is reported to the client, the browser is unlikely to use this information. The AddLanguage directive is more useful for content negotiation, where the server returns one from several documents based on the client's language preference.


AddType

Syntax: AddType mime-type extension extension...
Context: server config, virtual host, directory, .htaccess
Override: FileInfo
Status: Base
Module: mod_mime

The AddType directive adds to the list of filename extensions which filenames may end in for the specified content type. Mime-enc is the mime type to use for documents ending in extension. after content-encoding and language extensions have been removed. Example:

AddType image/gif GIF
It is recommended that new mime types be added using the AddType directive rather than changing the TypesConfig file.

Note that, unlike the NCSA httpd, this directive cannot be used to set the type of particular files.


TypesConfig

Syntax: TypesConfig filename
Default: TypesConfig conf/mime.types
Context: server config
Status: Base
Module: mod_mime

The TypesConfig directive sets the location of the mime types configuration file. Filename is relative to the ServerRoot. This file sets the default list of mappings from filename extensions to content types; changing this file is not recommended. Use the AddType directive instead. The file contains lines in the format of the arguments to an AddType command:

mime-type extension extension ...
The extensions are lower-cased. Blank lines, and lines beginning with a hash character (`#') are ignored.


Home Index