mod_mime.html revision d030d579df50673f566f5dbcd1904fd59cd310e0
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<HTML>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<HEAD>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<TITLE>Apache module mod_mime</TITLE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor</HEAD>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<BODY
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor BGCOLOR="#FFFFFF"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor TEXT="#000000"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor LINK="#0000FF"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor VLINK="#000080"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor ALINK="#FF0000"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<!--#include virtual="header.html" -->
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<H1 ALIGN="CENTER">Module mod_mime</H1>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorThis module is contained in the <CODE>mod_mime.c</CODE> file, and is
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcompiled in by default. It provides for determining the types of files
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfrom the filename.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<H2>Summary</H2>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorThis module is used to determine various bits of "meta information"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorabout documents. This information relates to the content of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylordocument and is returned to the browser or used in content-negotiation
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorwithin the server. In addition, a "handler" can be set for a document,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorwhich determines how the document will be processed within the server.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorThe directives <A HREF="#addencoding">AddEncoding</A>, <A
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorHREF="#addhandler">AddHandler</A>, <A
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorHREF="#addlanguage">AddLanguage</A> and <A HREF="#addtype">AddType</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorare all used to map file extensions onto the meta-information for that
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfile. Respectively they set the content-encoding, handler,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcontent-language and mime-type (content-type) of documents. The
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylordirective <A HREF="#typesconfig">TypesConfig</A> is used to specify a
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfile which also maps extensions onto mime types. The directives <A
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorHREF="#forcetype">ForceType</A> and <A
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorHREF="#sethandler">SetHandler</A> are used to associated all the files
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorin a given location (e.g. a particular directory) onto a particular
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylormime type or handler.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorFiles can have more than one extension, and the order of the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorextensions is normally irrelevant. For example, if the file
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<CODE>welcome.html.fr</CODE> maps onto content type text/html and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorlanguage French then the file <CODE>welcome.fr.html</CODE> will map
9e39c5ba00a55fa05777cc94b148296af305e135Bill Tayloronto exactly the same information. The only exception to this is if an
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorextension is given which Apache does not know how to handle. In this
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcase it will "forget" about any information it obtained from
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorextensions to the left of the unknown extension. So, for example, if
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorthe extensions fr and html are mapped to the appropriate language and
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortype but extension xxx is not assigned to anything, then the file
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<CODE>welcome.fr.xxx.html</CODE> will be associated with content-type
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylortext/html but <EM>no</EM> language.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorNote that changing the type or encoding of a file does not change the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorvalue of the <CODE>Last-Modified</CODE> header. Thus, previously cached
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcopies may still be used by a client or proxy, with the previous headers.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorPlease note that changing a file's type or encoding does not change
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorthe value of the <CODE>Last-Modified</CODE> header. Previously cached
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcopies may still be used by a client or proxy.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<H2> Directives</H2>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<UL>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#addencoding">AddEncoding</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#addhandler">AddHandler</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#addlanguage">AddLanguage</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#addtype">AddType</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#forcetype">ForceType</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#sethandler">SetHandler</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<LI><A HREF="#typesconfig">TypesConfig</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor</UL>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<HR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<H2><A NAME="addencoding">AddEncoding</A></H2>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<!--%plaintext &lt;?INDEX {\tt AddEncoding} directive&gt; -->
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Syntax"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Syntax:</STRONG></A> AddEncoding <EM>mime-enc extension extension...</EM><BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Context"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Override"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Override:</STRONG></A> FileInfo<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Status"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Status:</STRONG></A> Base<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Module"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Module:</STRONG></A> mod_mime<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorThe AddEncoding directive adds to the list of filename extensions which
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfilenames may end in for the specified encoding type. <EM>Mime-enc</EM>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Tayloris the mime encoding to use for documents ending in <EM>extension</EM>.
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorExample:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<BLOCKQUOTE><CODE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorAddEncoding x-gzip gz<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorAddEncoding x-compress Z
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor</CODE></BLOCKQUOTE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorThis will cause files ending in .gz to be marked as encoded using the x-gzip
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorencoding, and .Z files to be marked as encoded with x-compress.<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorOld clients expect <CODE>x-gzip</CODE> and <CODE>x-compress</CODE>,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorhowever the standard dictates that they're equivalent to <CODE>gzip</CODE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorand <CODE>compress</CODE> respectively. Apache does content encoding
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorcomparisons by ignoring any leading <CODE>x-</CODE>. When responding
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorwith an encoding Apache will use whatever form (i.e. <CODE>x-foo</CODE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Tayloror <CODE>foo</CODE>) the client requested. If the client didn't
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorspecifically request a particular form Apache will use the form given by
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorthe <CODE>AddEncoding</CODE> directive. To make this long story short,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Tayloryou should always use <CODE>x-gzip</CODE> and <CODE>x-compress</CODE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfor these two specific encodings. More recent encodings, such as
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<CODE>deflate</CODE> should be specified without the <CODE>x-</CODE>.
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P><HR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<H2><A NAME="addhandler">AddHandler</A></H2>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Syntax"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Syntax:</STRONG></A> AddHandler <EM>handler-name extension extension...</EM><BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Context"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Status"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Status:</STRONG></A> Base<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Module"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Module:</STRONG></A> mod_mime<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Compatibility"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Compatibility:</STRONG></A> AddHandler is only available in Apache
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor1.1 and later<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>AddHandler maps the filename extensions <EM>extension</EM> to the
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A HREF="/handler.html">handler</A>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<EM>handler-name</EM>. For example, to activate CGI scripts
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorwith the file extension "<CODE>.cgi</CODE>", you might use:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<PRE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor AddHandler cgi-script cgi
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor</PRE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<P>Once that has been put into your srm.conf or httpd.conf file, any
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfile ending with "<CODE>.cgi</CODE>" will be treated as a CGI
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorprogram.</P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<HR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<H2><A NAME="addlanguage">AddLanguage</A></H2>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<!--%plaintext &lt;?INDEX {\tt AddLanguage} directive&gt; -->
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Syntax"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Syntax:</STRONG></A> AddLanguage <EM>mime-lang extension extension...</EM><BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Context"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Override"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Override:</STRONG></A> FileInfo<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Status"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Status:</STRONG></A> Base<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<A
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor HREF="directive-dict.html#Module"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor REL="Help"
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor><STRONG>Module:</STRONG></A> mod_mime<P>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorThe AddLanguage directive adds to the list of filename extensions which
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorfilenames may end in for the specified content language. <EM>Mime-lang</EM>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Tayloris the mime language of files with names ending <EM>extension</EM>,
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylorafter any content encoding extensions have been removed. Example:
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor<BLOCKQUOTE><CODE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorAddEncoding x-compress Z<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorAddLanguage en .en<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill TaylorAddLanguage fr .fr<BR>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor</CODE></BLOCKQUOTE>
9e39c5ba00a55fa05777cc94b148296af305e135Bill Taylor
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 &lt;?INDEX {\tt AddType} directive&gt; -->
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> AddType <EM>mime-type extension extension...</EM><BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
<A
HREF="directive-dict.html#Override"
REL="Help"
><STRONG>Override:</STRONG></A> FileInfo<BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> 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:
<BLOCKQUOTE><CODE>
AddType image/gif GIF
</CODE></BLOCKQUOTE>
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>
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> ForceType <EM>media type</EM><BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> mod_mime<BR>
<A
HREF="directive-dict.html#Compatibility"
REL="Help"
><STRONG>Compatibility:</STRONG></A> ForceType is only available in Apache
1.1 and later.<P>
<P>When placed into an <CODE>.htaccess</CODE> file or a
<CODE>&lt;Directory&gt;</CODE> or <CODE>&lt;Location&gt;</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:
<PRE>
ForceType image/gif
</PRE>
<P>Note that this will override any filename extensions that might determine
the media type.</P><HR>
<H2><A NAME="sethandler">SetHandler</A></H2>
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> SetHandler <EM>handler-name</EM><BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> mod_mime<BR>
<A
HREF="directive-dict.html#Compatibility"
REL="Help"
><STRONG>Compatibility:</STRONG></A> SetHandler is only available in Apache
1.1 and later.<P>
<P>When placed into an <CODE>.htaccess</CODE> file or a
<CODE>&lt;Directory&gt;</CODE> or <CODE>&lt;Location&gt;</CODE> section,
this directive forces all matching files to be parsed through the
<A HREF="/handler.html">handler</A>
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:
<PRE>
SetHandler imap-file
</PRE>
<P>Another example: if you wanted to have the server display a status
report whenever a URL of <CODE>http://servername/status</CODE> was
called, you might put the following into access.conf:
<PRE>
&lt;Location /status&gt;
SetHandler server-status
&lt;/Location&gt;
</PRE>
<HR>
<H2><A NAME="typesconfig">TypesConfig</A></H2>
<!--%plaintext &lt;?INDEX {\tt TypesConfig} directive&gt; -->
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> TypesConfig <EM>filename</EM><BR>
<A
HREF="directive-dict.html#Default"
REL="Help"
><STRONG>Default:</STRONG></A> <CODE>TypesConfig conf/mime.types</CODE><BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> server config<BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> 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>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>