409N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
50N/A<
TITLE>Apache module mod_mime</
TITLE>
50N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 50N/A<
H1 ALIGN="CENTER">Module mod_mime</
h1>
50N/Acompiled in by default. It provides for determining the types of files
50N/AThis module is used to determine various bits of "meta information"
50N/Aabout documents. This information relates to the content of the
60N/Adocument and is returned to the browser or used in content-negotiation
202N/Awithin the server. In addition, a "handler" can be set for a document,
50N/Awhich determines how the document will be processed within the server.
307N/AThe directives <
A HREF="#addencoding">AddEncoding</
A>, <
A 384N/AHREF="#addhandler">AddHandler</
A>, <
A 487N/AHREF="#addlanguage">AddLanguage</
A> and <
A HREF="#addtype">AddType</
A>
838N/Aare all used to map file extensions onto the meta-information for that
956N/Afile. Respectively they set the content-encoding, handler,
50N/Acontent-language and mime-type (content-type) of documents. The
50N/Adirective <
A HREF="#typesconfig">TypesConfig</
A> is used to specify a
50N/Afile which also maps extensions onto mime types. The directives <
A 50N/AHREF="#forcetype">ForceType</
A> and <
A 66N/AHREF="#sethandler">SetHandler</
A> are used to associated all the files
135N/Ain a given location (
e.g. a particular directory) onto a particular
66N/Amime type or handler.
50N/AFiles can have more than one extension, and the order of the
50N/Aextensions is normally irrelevant. For example, if the file
400N/Aonto exactly the same information. The only exception to this is if an
964N/Aextension is given which Apache does not know how to handle. In this
964N/Acase it will "forget" about any information it obtained from
400N/Aextensions to the left of the unknown extension. So, for example, if
50N/Athe extensions fr and html are mapped to the appropriate language and
50N/Atype but extension xxx is not assigned to anything, then the file
580N/A<
li><
A HREF="#addencoding">AddEncoding</
A>
580N/A<
li><
A HREF="#addhandler">AddHandler</
A>
63N/A<
li><
A HREF="#addlanguage">AddLanguage</
A>
72N/A<
li><
A HREF="#addtype">AddType</
A>
72N/A<
li><
A HREF="#forcetype">ForceType</
A>
202N/A<
li><
A HREF="#sethandler">SetHandler</
A>
72N/A<
li><
A HREF="#typesconfig">TypesConfig</
A>
583N/A<
h2><
A name="addencoding">AddEncoding</
A></
h2>
583N/A<!--%plaintext <?INDEX {\tt AddEncoding} directive> --> 1003N/A<
strong>Syntax:</
strong> AddEncoding <
em>mime-enc extension extension...</
em><
br>
583N/A<
Strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
583N/A<
Strong>Override:</
strong> FileInfo<
br>
583N/A<
strong>Status:</
strong> Base<
br>
583N/A<
strong>Module:</
strong> mod_mime<
p>
583N/AThe AddEncoding directive adds to the list of filename extensions which
583N/Afilenames may end in for the specified encoding type. <
em>Mime-enc</
em>
583N/Ais the mime encoding to use for documents ending in <
em>extension</
em>.
583N/AAddEncoding x-gzip gz<
br>
242N/AAddEncoding x-compress Z
50N/A</
code></
blockquote>
400N/AThis will cause files ending in .gz to be marked as encoded using the x-gzip
50N/Aencoding, and .Z files to be marked as encoded with x-compress.<
p><
hr>
59N/A<
h2><
a name="addhandler">AddHandler</
a></
h2>
242N/A<
strong>Syntax:</
strong> AddHandler <
em>handler-name extension extension...</
em><
br>
66N/A<
strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
400N/A<
strong>Status:</
strong> Base<
br>
66N/A<
strong>Module:</
strong> mod_mime<
br>
195N/A<
strong>Compatibility:</
strong> AddHandler is only available in Apache
50N/A<
p>AddHandler maps the filename extensions <
em>extension</
em> to the
235N/A<
em>handler-name</
em>. For example, to activate CGI scripts
235N/Awith the file extension "<
code>.cgi</
code>", you might use:
235N/A AddHandler cgi-script cgi
307N/Afile ending with "<
code>.cgi</
code>" will be treated as a CGI
307N/A<
h2><
A name="addlanguage">AddLanguage</
A></
h2>
307N/A<!--%plaintext <?INDEX {\tt AddLanguage} directive> --> 307N/A<
strong>Syntax:</
strong> AddLanguage <
em>mime-lang extension extension...</
em><
br>
307N/A<
Strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
838N/A<
Strong>Override:</
strong> FileInfo<
br>
66N/A<
strong>Status:</
strong> Base<
br>
50N/A<
strong>Module:</
strong> mod_mime<
p>
66N/AThe AddLanguage directive adds to the list of filename extensions which
66N/Afilenames may end in for the specified content language. <
em>Mime-lang</
em>
66N/Ais the mime language of files with names ending <
em>extension</
em>,
50N/Aafter any content encoding extensions have been removed. Example:
72N/AAddEncoding x-compress Z<
br>
400N/AThen the document <
code>
xxxx.
en.
Z</
code> will be treated as being a compressed
400N/AEnglish document. Although the content language is reported to the client,
50N/Athe browser is unlikely to use this information. The AddLanguage directive
111N/Ais more useful for content negotiation, where the server returns one
111N/Afrom several documents based on the client's language preference.<
p><
hr>
111N/A<
h2><
A name="addtype">AddType</
A></
h2>
111N/A<!--%plaintext <?INDEX {\tt AddType} directive> --> 111N/A<
strong>Syntax:</
strong> AddType <
em>mime-type extension extension...</
em><
br>
838N/A<
Strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
838N/A<
Strong>Override:</
strong> FileInfo<
br>
50N/A<
strong>Status:</
strong> Base<
br>
307N/A<
strong>Module:</
strong> mod_mime<
p>
307N/AThe AddType directive adds to the list of filename extensions which
307N/Afilenames may end in for the specified content type. <
em>Mime-enc</
em>
307N/Ais the mime type to use for documents ending in <
em>extension</
em>.
964N/Aafter content-encoding and language extensions have been removed. Example:
964N/AIt is recommended that new mime types be added using the AddType directive
307N/Arather than changing the <
A HREF="#typesconfig">TypesConfig</
A> file.<
p>
307N/ANote that, unlike the NCSA httpd, this directive cannot be used to set the
400N/Atype of particular files.<
p><
hr>
307N/A<
h2><
a name="forcetype">ForceType</
a></
h2>
400N/A<
strong>Syntax:</
strong> ForceType <
em>media type</
em><
br>
400N/A<
strong>Context:</
strong> directory, .htaccess<
br>
400N/A<
strong>Status:</
strong> Base<
br>
583N/A<
strong>Module:</
strong> mod_mime<
br>
583N/A<
strong>Compatibility:</
strong> ForceType is only available in Apache
400N/A<
p>When placed into an <
code>.htaccess</
code> file or a
964N/A<
code><Directory></
code> or <
code><Location></
code> section,
964N/Athis directive forces all matching files to be served
400N/Aas the content type given by <
em>media type</
em>. For example, if you
400N/Ahad a directory full of GIF files, but did not want to label them all with
964N/A".gif", you might want to use:
400N/A<
p>Note that this will override any filename extensions that might
400N/A<
h2><
a name="sethandler">SetHandler</
a></
h2>
400N/A<
strong>Syntax:</
strong> SetHandler <
em>handler-name</
em><
br>
235N/A<
strong>Context:</
strong> directory, .htaccess<
br>
400N/A<
strong>Status:</
strong> Base<
br>
400N/A<
strong>Module:</
strong> mod_mime<
br>
235N/A<
strong>Compatibility:</
strong> SetHandler is only available in Apache
235N/A<
p>When placed into an <
code>.htaccess</
code> file or a
235N/A<
code><Directory></
code> or <
code><Location></
code> section,
487N/Athis directive forces all matching files to be parsed through the
235N/Agiven by <
em>handler-name</
em>. For example, if you had a
400N/Adirectory you wanted to be parsed entirely as imagemap rule files,
235N/Aregardless of extension, you might put the following into an
235N/A<
code>.htaccess</
code> file in that directory:
235N/A<
p>Another example: if you wanted to have the server display a status
235N/A <Location /status>
235N/A SetHandler server-status
388N/A<
h2><
A name="typesconfig">TypesConfig</
A></
h2>
388N/A<!--%plaintext <?INDEX {\tt TypesConfig} directive> --> 135N/A<
strong>Syntax:</
strong> TypesConfig <
em>filename</
em><
br>
66N/A<
Strong>Context:</
strong> server config<
br>
66N/A<
strong>Status:</
strong> Base<
br>
66N/A<
strong>Module:</
strong> mod_mime<
p>
202N/AThe TypesConfig directive sets the location of the mime types configuration
72N/Afile. <
em>Filename</
em> is relative to the
136N/A<
A HREF="core.html#serverroot">ServerRoot</
A>. This file sets the default list of
66N/Amappings from filename extensions to content types; changing this file is not
136N/Arecommended. Use the <
A HREF="#addtype">AddType</
A> directive instead. The
66N/Afile contains lines in the format of the arguments to an AddType command:
481N/A<
blockquote><
em>mime-type extension extension ...</
em></
blockquote>
481N/AThe extensions are lower-cased. Blank lines, and lines beginning with a hash
481N/Acharacter (`#') are ignored.<
p>