Whole document tree ![]() Apache HTTP Server Version 1.3Module mod_mimeThis module provides for determining the types of files from the filename and for association of handlers with files. Status: Base SummaryThis module is used to determine various bits of "meta information" about documents. This information relates to the content of the document and is returned to the browser or used in content-negotiation within the server. In addition, a "handler" can be set for a document, which determines how the document will be processed within the server.The directives AddCharset, AddEncoding, AddHandler, AddLanguage and AddType are all used to map file extensions onto the meta-information for that file. Respectively they set the character set, content-encoding, handler, content-language, and MIME-type (content-type) of documents. The directive TypesConfig is used to specify a file which also maps extensions onto MIME types. The directives ForceType and SetHandler are used to associated all the files in a given location (e.g., a particular directory) onto a particular MIME type or handler. Note that changing the type or encoding of a file does not
change the value of the Directives
See also: MimeMagicFile. Files with Multiple ExtensionsFiles can have more than one extension, and the order of the extensions is normally irrelevant. For example, if the filewelcome.html.fr maps onto content type
text/html and language French then the file
welcome.fr.html will map onto exactly the same
information. The only exception to this is if an extension is
given which Apache does not know how to handle. In this case it
will "forget" about any information it obtained from extensions
to the left of the unknown extension. So, for example, if the
extensions fr and html are mapped to the appropriate language
and type but extension xxx is not assigned to anything, then
the file welcome.fr.xxx.html will be associated
with content-type text/html but no language.
If more than one extension is given which maps onto the same
type of meta-information, then the one to the right will be
used. For example, if ".gif" maps to the MIME-type image/gif
and ".html" maps to the MIME-type text/html, then the file
Care should be taken when a file with multiple extensions
gets associated with both a MIME-type and a handler. This will
usually result in the request being by the module associated
with the handler. For example, if the AddCharset directiveSyntax: AddCharset charset extension [extension] ...Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_mime Compatibility: AddCharset is only available in Apache 1.3.10 and later The AddCharset directive maps the given filename extensions to the specified content charset. charset is the MIME charset parameter of filenames containing extension. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. Example: AddLanguage ja .ja AddCharset EUC-JP .euc AddCharset ISO-2022-JP .jis AddCharset SHIFT_JIS .sjis Then the document The extension argument is case-insensitive, and can be specified with or without a leading dot. See also: mod_negotiation AddEncoding directiveSyntax: AddEncoding MIME-enc extension [extension] ...Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_mime The AddEncoding directive maps the given filename extensions to the specified encoding type. MIME-enc is the MIME encoding to use for documents containing the extension. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. Example:
This will cause filenames containing the .gz extension to be
marked as encoded using the x-gzip encoding, and filenames
containing the .Z extension to be marked as encoded with
x-compress.
Old clients expect The extension argument is case-insensitive, and can be specified with or without a leading dot. See also: Files with multiple extensions AddHandler directiveSyntax: AddHandler handler-name extension [extension] ...Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_mime Compatibility: AddHandler is only available in Apache 1.1 and later AddHandler maps the filename extensions extension
to the handler
handler-name. This mapping is added to any already in
force, overriding any mappings that already exist for the same
extension. For example, to activate CGI scripts with
the file extension " AddHandler cgi-script .cgi Once that has been put into your srm.conf or httpd.conf
file, any file containing the " The extension argument is case-insensitive, and can be specified with or without a leading dot. See also: Files with multiple extensions, SetHandler AddLanguage directiveSyntax: AddLanguage MIME-lang extension [extension] ...Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_mime The AddLanguage directive maps the given filename extension to the specified content language. MIME-lang is the MIME language of filenames containing extension. This mapping is added to any already in force, overriding any mappings that already exist for the same extension. Example:
Then the document If multiple language assignments are made for the same extension, the last one encountered is the one that is used. That is, for the case of: AddLanguage en .en AddLanguage en-uk .en AddLanguage en-us .en documents with the extension " The extension argument is case-insensitive, and can be specified with or without a leading dot. See also: Files with
multiple extensions, DefaultLanguage AddType directiveSyntax: AddType MIME-type extension [extension] ...Context: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_mime The AddType directive maps the given filename extensions
onto the specified content type. MIME-type is the MIME
type to use for filenames containing extension. This
mapping is added to any already in force, overriding any
mappings that already exist for the same extension.
This directive can be used to add mappings not listed in the
MIME types file (see the
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. The extension argument is case-insensitive, and can be specified with or without a leading dot. See also: Files with multiple extensions DefaultLanguage directiveSyntax: DefaultLanguage MIME-langContext: server config, virtual host, directory, .htaccess Override: FileInfo Status: Base Module: mod_mime Compatibility: DefaultLanguage is only available in Apache 1.3.4 and later. The DefaultLanguage directive tells Apache that all files in
the directive's scope (e.g., all files covered by the
current For example: DefaultLanguage fr
If no DefaultLanguage directive is in force, and a file does not have any language extensions as configured by AddLanguage, then that file will be considered to have no language attribute. See also: mod_negotiation ForceType directiveSyntax: ForceType media-typeContext: directory, .htaccess Status: Base Module: mod_mime Compatibility: ForceType is only available in Apache 1.1 and later. When placed into an ForceType image/gif Note that this will override any filename extensions that might determine the media type. See also: AddType RemoveEncoding directiveSyntax: RemoveEncoding extension [extension] ...Context: directory, .htaccess Status: Base Module: mod_mime Compatibility: RemoveEncoding is only available in Apache 1.3.13 and later. The RemoveEncoding directive removes any
encoding associations for files with the given extensions. This
allows
This will cause Note:RemoveEncoding directives are processed after any AddEncoding directives, so it is possible they may undo the effects of the latter if both occur within the same directory configuration. The extension argument is case-insensitive, and can be specified with or without a leading dot. RemoveHandler directiveSyntax: RemoveHandler extension [extension] ...Context: directory, .htaccess Status: Base Module: mod_mime Compatibility: RemoveHandler is only available in Apache 1.3.4 and later. The RemoveHandler directive removes any handler
associations for files with the given extensions. This allows
This has the effect of returning .html files in the /foo/bar directory to being treated as normal files, rather than as candidates for parsing (see the mod_include module). The extension argument is case-insensitive, and can be specified with or without a leading dot. RemoveType directiveSyntax: RemoveType extension [extension] ...Context: directory, .htaccess Status: Base Module: mod_mime Compatibility: RemoveType is only available in Apache 1.3.13 and later. The RemoveType directive removes any MIME type
associations for files with the given extensions. This allows
This will remove any special handling of Note: The extension argument is case-insensitive, and can be specified with or without a leading dot. SetHandler directiveSyntax: SetHandler handler-nameContext: directory, .htaccess Status: Base Module: mod_mime Compatibility: SetHandler is only available in Apache 1.1 and later. When placed into an SetHandler imap-file Another example: if you wanted to have the server display a
status report whenever a URL of
<Location /status> SetHandler server-status </Location> See also: AddHandler TypesConfig directiveSyntax: TypesConfig file-pathDefault: 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.
Apache HTTP Server Version 1.3![]() ![]() |