Files can have more than one extension, and the order of the
extensions is normally irrelevant. For example, if the file
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
Note that changing the type or encoding of a file does not change the
value of the <
code>Last-Modified</
code> header. Thus, previously cached
copies may still be used by a client or proxy, with the previous headers.
<
li><
A HREF="#addencoding">AddEncoding</
A>
<
li><
A HREF="#addhandler">AddHandler</
A>
<
li><
A HREF="#addlanguage">AddLanguage</
A>
<
li><
A HREF="#addtype">AddType</
A>
<
li><
A HREF="#forcetype">ForceType</
A>
<
li><
A HREF="#sethandler">SetHandler</
A>
<
li><
A HREF="#typesconfig">TypesConfig</
A>
<
h2><
A name="addencoding">AddEncoding</
A></
h2>
<!--%plaintext <?INDEX {\tt AddEncoding} directive> --> <
strong>Syntax:</
strong> AddEncoding <
em>mime-enc extension extension...</
em><
br>
<
Strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
<
Strong>Override:</
strong> FileInfo<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
p>
The AddEncoding directive adds to the list of filename extensions which
filenames may end in for the specified encoding type. <
em>Mime-enc</
em>
is the mime encoding to use for documents ending in <
em>extension</
em>.
AddEncoding x-gzip gz<
br>
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.<
p><
hr>
<
h2><
a name="addhandler">AddHandler</
a></
h2>
<
strong>Syntax:</
strong> AddHandler <
em>handler-name extension extension...</
em><
br>
<
strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
br>
<
strong>Compatibility:</
strong> AddHandler is only available in Apache
<
p>AddHandler maps the filename extensions <
em>extension</
em> to the
<
em>handler-name</
em>. For example, to activate CGI scripts
with the file extension "<
code>.cgi</
code>", you might use:
AddHandler cgi-script cgi
file ending with "<
code>.cgi</
code>" will be treated as a CGI
<
h2><
A name="addlanguage">AddLanguage</
A></
h2>
<!--%plaintext <?INDEX {\tt AddLanguage} directive> --> <
strong>Syntax:</
strong> AddLanguage <
em>mime-lang extension extension...</
em><
br>
<
Strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
<
Strong>Override:</
strong> FileInfo<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
p>
The AddLanguage directive adds to the list of filename extensions which
filenames may end in for the specified content language. <
em>Mime-lang</
em>
is the mime language of files with names ending <
em>extension</
em>,
after any content encoding extensions have been removed. Example:
AddEncoding x-compress Z<
br>
Then the document <
code>
xxxx.
en.
Z</
code> 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.<
p><
hr>
<
h2><
A name="addtype">AddType</
A></
h2>
<!--%plaintext <?INDEX {\tt AddType} directive> --> <
strong>Syntax:</
strong> AddType <
em>mime-type extension extension...</
em><
br>
<
Strong>Context:</
strong> server config, virtual host, directory, .htaccess<
br>
<
Strong>Override:</
strong> FileInfo<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
p>
The AddType directive adds to the list of filename extensions which
filenames may end in for the specified content type. <
em>Mime-enc</
em>
is the mime type to use for documents ending in <
em>extension</
em>.
after content-encoding and language extensions have been removed. Example:
It is recommended that new mime types be added using the AddType directive
rather than changing the <
A HREF="#typesconfig">TypesConfig</
A> file.<
p>
Note that, unlike the NCSA httpd, this directive cannot be used to set the
type of particular files.<
p><
hr>
<
h2><
a name="forcetype">ForceType</
a></
h2>
<
strong>Syntax:</
strong> ForceType <
em>media type</
em><
br>
<
strong>Context:</
strong> directory, .htaccess<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
br>
<
strong>Compatibility:</
strong> ForceType is only available in Apache
<
p>When placed into an <
code>.htaccess</
code> file or a
<
code><Directory></
code> or <
code><Location></
code> section,
this directive forces all matching files to be served
as the content type given by <
em>media type</
em>. For example, if you
had a directory full of GIF files, but did not want to label them all with
".gif", you might want to use:
<
p>Note that this will override any filename extensions that might
<
h2><
a name="sethandler">SetHandler</
a></
h2>
<
strong>Syntax:</
strong> SetHandler <
em>handler-name</
em><
br>
<
strong>Context:</
strong> directory, .htaccess<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
br>
<
strong>Compatibility:</
strong> SetHandler is only available in Apache
<
p>When placed into an <
code>.htaccess</
code> file or a
<
code><Directory></
code> or <
code><Location></
code> section,
this directive forces all matching files to be parsed through the
given by <
em>handler-name</
em>. For example, if you had a
directory you wanted to be parsed entirely as imagemap rule files,
regardless of extension, you might put the following into an
<
code>.htaccess</
code> file in that directory:
<
p>Another example: if you wanted to have the server display a status
<
h2><
A name="typesconfig">TypesConfig</
A></
h2>
<!--%plaintext <?INDEX {\tt TypesConfig} directive> --> <
strong>Syntax:</
strong> TypesConfig <
em>filename</
em><
br>
<
strong>Default:</
strong> <
code>TypesConfig
conf/
mime.types</
code><
br>
<
Strong>Context:</
strong> server config<
br>
<
strong>Status:</
strong> Base<
br>
<
strong>Module:</
strong> mod_mime<
p>
The TypesConfig directive sets the location of the mime types configuration
file. <
em>Filename</
em> is relative to the
<
A HREF="core.html#serverroot">ServerRoot</
A>. This file sets the default list of
mappings from filename extensions to content types; changing this file is not
recommended. Use the <
A HREF="#addtype">AddType</
A> directive instead. The
file contains lines in the format of the arguments to an AddType command:
<
blockquote><
em>mime-type extension extension ...</
em></
blockquote>
The extensions are lower-cased. Blank lines, and lines beginning with a hash
character (`#') are ignored.<
p>