mod_mime.html revision 1997e02bed99bd0c081962ade257a0ea12ebe15b
7968d3a131e5a684ec1ff0c6d88aae638549153dChristian Maeder<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder<HTML>
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski<HEAD>
7968d3a131e5a684ec1ff0c6d88aae638549153dChristian Maeder<TITLE>Apache module mod_mime</TITLE>
b87efd3db0d2dc41615ea28669faf80fc1b48d56Corneliu-Claudiu Prodescu</HEAD>
2eeec5240b424984e3ee26296da1eeab6c6d739eChristian Maeder
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder<BODY
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder BGCOLOR="#FFFFFF"
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski TEXT="#000000"
679d3f541f7a9ede4079e045f7758873bb901872Till Mossakowski LINK="#0000FF"
679d3f541f7a9ede4079e045f7758873bb901872Till Mossakowski VLINK="#000080"
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder ALINK="#FF0000"
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<!--#include virtual="header.html" -->
4c8d3c5a9e938633f6147b5a595b9b93bfca99e6Christian Maeder<H1 ALIGN="CENTER">Module mod_mime</H1>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder
0fe1b901cec27c06b8aad7548f56a7cab4dee6a4Till Mossakowski<p>This module provides for determining the types of files
fa1efeb55163f27f261d22a9062fbc25ab4d8d52Michael Chanfrom the filename and for association of handlers with files.</p>
fa1efeb55163f27f261d22a9062fbc25ab4d8d52Michael Chan
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<P><A
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian MaederHREF="module-dict.html#Status"
f69658e57cba7ecb37c0d84181f4c563215c2534Till MossakowskiREL="Help"
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder><STRONG>Status:</STRONG></A> Base
ba904a15082557e939db689fcfba0c68c9a4f740Christian Maeder<BR>
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder<A
d420c2a27c4dfa0a9c8031449db2e1a89ad2cc3aChristian MaederHREF="module-dict.html#SourceFile"
ba904a15082557e939db689fcfba0c68c9a4f740Christian MaederREL="Help"
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder><STRONG>Source File:</STRONG></A> mod_mime.c
cc5f3c5391fbe9d1274e3a3afb1dc458bb424ba5Christian Maeder<BR>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<A
ec25781c1180ea07f66b48c34f93cf5634e9277cChristian MaederHREF="module-dict.html#ModuleIdentifier"
ba904a15082557e939db689fcfba0c68c9a4f740Christian MaederREL="Help"
e182d0ec56025d97d74829cac75ee31eec12b093Maciek Makowski><STRONG>Module Identifier:</STRONG></A> mime_module
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder</P>
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder
9603ad7198b72e812688ad7970e4eac4b553837aKlaus Luettich<H2>Summary</H2>
ba904a15082557e939db689fcfba0c68c9a4f740Christian Maeder
58b671de3fe578346fef9642ffa3c5a0a0edb3cbTill MossakowskiThis module is used to determine various bits of "meta information"
56cd0da55d058b262b1626ddcd78db6bd9a90551Christian Maederabout documents. This information relates to the content of the
ba904a15082557e939db689fcfba0c68c9a4f740Christian Maederdocument and is returned to the browser or used in content-negotiation
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maederwithin the server. In addition, a "handler" can be set for a document,
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maederwhich determines how the document will be processed within the server.
ba904a15082557e939db689fcfba0c68c9a4f740Christian Maeder
d5a8d891500a642ce629854857fc00b7c21aec47Christian Maeder<P>
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder
43b4c41fbb07705c9df321221ab9cb9832460407Christian MaederThe directives <a href="#addcharset">AddCharset</a>,
43b4c41fbb07705c9df321221ab9cb9832460407Christian Maeder<A HREF="#addencoding">AddEncoding</A>, <A HREF="#addhandler">AddHandler</A>,
4c8d3c5a9e938633f6147b5a595b9b93bfca99e6Christian Maeder<A HREF="#SetFilter">SetFilter</A>, <A HREF="#addlanguage">AddLanguage</A>
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maederand <A HREF="#addtype">AddType</A> are all used to map file extensions onto
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maederthe meta-information for that file. Respectively they set the character set,
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maedercontent-encoding, handler, content-language, and MIME-type (content-type) of
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maederdocuments. The directive <A HREF="#typesconfig">TypesConfig</A> is used to
b9804822fb178b0fc27ce967a6a8cedc42c5bf90Christian Maederspecify a file which also maps extensions onto MIME types. The directives
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder<A HREF="#forcetype">ForceType</A> and <A HREF="#sethandler">SetHandler</A>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maederare used to associated all the files in a given location (<EM>e.g.</EM>, a
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maederparticular directory) onto a particular MIME type or handler.
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<P>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian MaederNote that changing the type or encoding of a file does not change the
c4040537e6f2153af475dd8b07260a1ee9a56ac0Christian Maedervalue of the <CODE>Last-Modified</CODE> header. Thus, previously cached
be43c3fa0292555bd126784ae27ff5c1d23438cbChristian Maedercopies may still be used by a client or proxy, with the previous headers.
b0294d73dcefc502ddaa13e18b46103a5916971fTill Mossakowski
53a877c93b93d82cffe0f1977b5bf757ed84f9a5Mihai Codescu<H2>Directives</H2>
8a4ad94c497663adf4d1ee03f8352534faa23323Kristina Sojakova<UL>
f20841e0b3d9311fd39f2615e43538214f720dd5Kristina Sojakova<li><a href="#addcharset">AddCharset</a></li>
f20841e0b3d9311fd39f2615e43538214f720dd5Kristina Sojakova<LI><A HREF="#addencoding">AddEncoding</A>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<LI><A HREF="#addhandler">AddHandler</A>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder<LI><A HREF="#setfilter">SetFilter</A>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<LI><A HREF="#addlanguage">AddLanguage</A>
1b05bdb88b90d3c947351f262d7ae7d68f0a4a6fTill Mossakowski<LI><A HREF="#addtype">AddType</A>
1b05bdb88b90d3c947351f262d7ae7d68f0a4a6fTill Mossakowski<LI><A HREF="#defaultlanguage">DefaultLanguage</A>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder<LI><A HREF="#forcetype">ForceType</A>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder<LI><A HREF="#removehandler">RemoveHandler</A>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder<LI><A HREF="#sethandler">SetHandler</A>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder<LI><A HREF="#typesconfig">TypesConfig</A>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder</UL>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder<p>See also: <a
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maederhref="mod_mime_magic.html#mimemagicfile">MimeMagicFile</a>.</p>
f39c70229e74147a02d15bd45c05a0b1b325532dChristian Maeder
21dae7237ac384abdb94a81e00b3f099873ec623Till Mossakowski<H2><A NAME="multipleext">Files with Multiple Extensions</A></H2>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder
f39c70229e74147a02d15bd45c05a0b1b325532dChristian MaederFiles can have more than one extension, and the order of the
b03274844ecd270f9e9331f51cc4236a33e2e671Christian Maederextensions is <EM>normally</EM> irrelevant. For example, if the file
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<CODE>welcome.html.fr</CODE> maps onto content type text/html and
f39c70229e74147a02d15bd45c05a0b1b325532dChristian Maederlanguage French then the file <CODE>welcome.fr.html</CODE> will map
dc8100ead1e97ea34c9ff3fe4af14d37510bf8aeChristian Maederonto exactly the same information. The only exception to this is if an
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maederextension is given which Apache does not know how to handle. In this
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maedercase it will "forget" about any information it obtained from
53a877c93b93d82cffe0f1977b5bf757ed84f9a5Mihai Codescuextensions to the left of the unknown extension. So, for example, if
53a877c93b93d82cffe0f1977b5bf757ed84f9a5Mihai Codescuthe extensions fr and html are mapped to the appropriate language and
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maedertype but extension xxx is not assigned to anything, then the file
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<CODE>welcome.fr.xxx.html</CODE> will be associated with content-type
1b14aa136f3eb64b421dc610e46072aefcbd7c9fKristina Sojakovatext/html but <EM>no</EM> language.
1b14aa136f3eb64b421dc610e46072aefcbd7c9fKristina Sojakova
1b14aa136f3eb64b421dc610e46072aefcbd7c9fKristina Sojakova<P>
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder
d5a8d891500a642ce629854857fc00b7c21aec47Christian MaederIf more than one extension is given which maps onto the same type of
f0e85ee7e4accfc01f46aa0363acc59fcd248e8aTill Mossakowskimeta-information, then the one to the right will be used. For example,
f0e85ee7e4accfc01f46aa0363acc59fcd248e8aTill Mossakowskiif ".gif" maps to the MIME-type image/gif and ".html" maps to the
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian MaederMIME-type text/html, then the file <CODE>welcome.gif.html</CODE> will
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maederbe associated with the MIME-type "text/html".
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maeder<P>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian MaederCare should be taken when a file with multiple extensions gets
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maederassociated with both a MIME-type and a handler. This will usually
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maederresult in the request being by the module associated with the
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maederhandler. For example, if the <CODE>.imap</CODE> extension is mapped to
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maederthe handler "imap-file" (from mod_imap) and the <CODE>.html</CODE>
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maederextension is mapped to the MIME-type "text/html", then the file
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<CODE>world.imap.html</CODE> will be associated with both the
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maeder"imap-file" handler and "text/html" MIME-type. When it is processed,
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maederthe "imap-file" handler will be used, and so it will be treated as a
0c527c6e2157ab20bbce31e4a063975939fee4d2Ewaryst Schulzmod_imap imagemap file.
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<HR>
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<H2><A NAME="addcharset">AddCharset</A> directive</H2>
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<A HREF="directive-dict.html#Syntax" REL="Help"
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder><STRONG>Syntax:</STRONG></A> AddCharset <em>charset extension</em>
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maeder [<em>extension</em>] ...<br>
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<A HREF="directive-dict.html#Context" REL="Help"
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder<A
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder HREF="directive-dict.html#Override"
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder REL="Help"
4cbba4634ba267c438f75fa7a5009f6249d3dda1Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder<A
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder HREF="directive-dict.html#Status"
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder REL="Help"
429df04296fa571432f62cbfad6855e1420e0fd6Christian Maeder><STRONG>Status:</STRONG></A> Base<BR>
55e1458efb5b53c71df7d3263f5d7fae04503619Christian Maeder<A
55e1458efb5b53c71df7d3263f5d7fae04503619Christian Maeder HREF="directive-dict.html#Module"
55e1458efb5b53c71df7d3263f5d7fae04503619Christian Maeder REL="Help"
55e1458efb5b53c71df7d3263f5d7fae04503619Christian Maeder><STRONG>Module:</STRONG></A> mod_mime
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<P>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian MaederThe AddCharset directive maps the given filename extensions to the
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maederspecified content charset. <i>charset</i> is the MIME charset
e97bcfa4f74907e1a5ccfc3bc1509d1849cda603Christian Maederparameter of filenames containing <i>extension</i>. This mapping is
2afae0880da7ca73c9376fd4d653ab19833fe858Christian Maederadded to any already in force, overriding any mappings that already
4cbba4634ba267c438f75fa7a5009f6249d3dda1Christian Maederexist for the same <i>extension</i>.
0ea2cddb8715a770e646895e16b7b8085f49167cChristian Maeder</P>
2afae0880da7ca73c9376fd4d653ab19833fe858Christian Maeder<P>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian MaederExample:
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<pre>
21dae7237ac384abdb94a81e00b3f099873ec623Till Mossakowski AddLanguage ja .ja
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder AddCharset EUC-JP .euc
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder AddCharset ISO-2022-JP .jis
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder AddCharset SHIFT_JIS .sjis
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder</pre>
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder
b03274844ecd270f9e9331f51cc4236a33e2e671Christian Maeder<P>
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian MaederThen the document <CODE>xxxx.ja.jis</CODE> will be treated as being a
42972ddff400840d46eb54422b60083228b2996cChristian MaederJapanese document whose charset is ISO-2022-JP (as will the document
b03274844ecd270f9e9331f51cc4236a33e2e671Christian Maeder<CODE>xxxx.jis.ja</CODE>). The AddCharset directive is useful for both
bcd35fcdda4233c42766519772b2e9fbab57f975Christian Maederto inform the client about the character encoding of the document so
bcd35fcdda4233c42766519772b2e9fbab57f975Christian Maederthat the document can be interpreted and displayed appropriately, and
bcd35fcdda4233c42766519772b2e9fbab57f975Christian Maederfor <A HREF="/content-negotiation.html">content negotiation</A>, where
f39c70229e74147a02d15bd45c05a0b1b325532dChristian Maederthe server returns one from several documents based on the client's
bcd35fcdda4233c42766519772b2e9fbab57f975Christian Maedercharset preference.
bcd35fcdda4233c42766519772b2e9fbab57f975Christian Maeder</P>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maederbe specified with or without a leading dot.</p>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder<P>
be8b8876edf3d7138ddd39a4ec07d857dde5bbb5Christian Maeder<STRONG>See also</STRONG>: <A HREF="mod_negotiation.html">mod_negotiation</A>
be8b8876edf3d7138ddd39a4ec07d857dde5bbb5Christian Maeder</P>
be8b8876edf3d7138ddd39a4ec07d857dde5bbb5Christian Maeder
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<hr>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<H2><A NAME="addencoding">AddEncoding</A> directive</H2>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder<!--%plaintext &lt;?INDEX {\tt AddEncoding} directive&gt; -->
be8b8876edf3d7138ddd39a4ec07d857dde5bbb5Christian Maeder<A
a55b09f4ef6e58ad617b59899d93c63bb4d6f287Christian Maeder HREF="directive-dict.html#Syntax"
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder REL="Help"
b83ff3749d99d03b641adee264b781039a551addChristian Maeder><STRONG>Syntax:</STRONG></A> AddEncoding <EM>MIME-enc extension</em>
4cbba4634ba267c438f75fa7a5009f6249d3dda1Christian Maeder [<em>extension</EM>] ...<BR>
7297175957c5ad3c0498032190b1dee9ec5fb873Christian Maeder<A
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder HREF="directive-dict.html#Context"
17d4f8c5576d93f36cafe68161cdb960ec49ce7cChristian Maeder REL="Help"
17d4f8c5576d93f36cafe68161cdb960ec49ce7cChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder<A
f1d04fe5072b827d9cc490ebdbca78108241a392Christian Maeder HREF="directive-dict.html#Override"
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder REL="Help"
f1d04fe5072b827d9cc490ebdbca78108241a392Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<A
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder HREF="directive-dict.html#Status"
17d4f8c5576d93f36cafe68161cdb960ec49ce7cChristian Maeder REL="Help"
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder><STRONG>Status:</STRONG></A> Base<BR>
2afae0880da7ca73c9376fd4d653ab19833fe858Christian Maeder<A
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder HREF="directive-dict.html#Module"
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder REL="Help"
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder><STRONG>Module:</STRONG></A> mod_mime<P>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maeder
26ed2a19326560786ff94dfc462309d6d5d862a8Heng JiangThe AddEncoding directive maps the given filename extensions to the
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maederspecified encoding type. <EM>MIME-enc</EM> is the MIME encoding to use
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maederfor documents containing the <EM>extension</EM>. This mapping is added
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maederto any already in force, overriding any mappings that already exist
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maederfor the same <EM>extension</EM>.
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian MaederExample:
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<BLOCKQUOTE><CODE>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian MaederAddEncoding x-gzip .gz<BR>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian MaederAddEncoding x-compress .Z
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder</CODE></BLOCKQUOTE>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder
0155c8d32b79581866f07cc593aa8a4c722ceef2Christian MaederThis will cause filenames containing the .gz extension to be marked as
74b841a4b332085d5fd79975a13313c2681ae595Christian Maederencoded using the x-gzip encoding, and filenames containing the .Z
a765ab85cf4bffb8216ebe9a9ed4ffaf7ee61a18Mihai Codescuextension to be marked as encoded with x-compress.<P>
a765ab85cf4bffb8216ebe9a9ed4ffaf7ee61a18Mihai Codescu
74b841a4b332085d5fd79975a13313c2681ae595Christian MaederOld clients expect <CODE>x-gzip</CODE> and <CODE>x-compress</CODE>,
16023c23c9d17743033afd994ad11c386d17b376Christian Maederhowever the standard dictates that they're equivalent to <CODE>gzip</CODE>
74b841a4b332085d5fd79975a13313c2681ae595Christian Maederand <CODE>compress</CODE> respectively. Apache does content encoding
0155c8d32b79581866f07cc593aa8a4c722ceef2Christian Maedercomparisons by ignoring any leading <CODE>x-</CODE>. When responding
0155c8d32b79581866f07cc593aa8a4c722ceef2Christian Maederwith an encoding Apache will use whatever form (<EM>i.e.</EM>, <CODE>x-foo</CODE>
0155c8d32b79581866f07cc593aa8a4c722ceef2Christian Maederor <CODE>foo</CODE>) the client requested. If the client didn't
0155c8d32b79581866f07cc593aa8a4c722ceef2Christian Maederspecifically request a particular form Apache will use the form given by
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maederthe <CODE>AddEncoding</CODE> directive. To make this long story short,
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maederyou should always use <CODE>x-gzip</CODE> and <CODE>x-compress</CODE>
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maederfor these two specific encodings. More recent encodings, such as
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<CODE>deflate</CODE> should be specified without the <CODE>x-</CODE>.
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder
4d1386a4e547d8676886fdd2117dabd0fe035e6aChristian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maederbe specified with or without a leading dot.</p>
4d1386a4e547d8676886fdd2117dabd0fe035e6aChristian Maeder
74b841a4b332085d5fd79975a13313c2681ae595Christian Maeder<P>
26ed2a19326560786ff94dfc462309d6d5d862a8Heng Jiang
4d1386a4e547d8676886fdd2117dabd0fe035e6aChristian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
4d1386a4e547d8676886fdd2117dabd0fe035e6aChristian Maedermultiple extensions</A>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<P><HR>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<H2><A NAME="addhandler">AddHandler</A> directive</H2>
4d1386a4e547d8676886fdd2117dabd0fe035e6aChristian Maeder
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<A
7297175957c5ad3c0498032190b1dee9ec5fb873Christian Maeder HREF="directive-dict.html#Syntax"
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder REL="Help"
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder><STRONG>Syntax:</STRONG></A> AddHandler <EM>handler-name extension</em>
1b05bdb88b90d3c947351f262d7ae7d68f0a4a6fTill Mossakowski [<em>extension</EM>] ...<BR>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder<A
948f37fdb71c544ff4c907bc5863702648cf36e4Christian Maeder HREF="directive-dict.html#Context"
948f37fdb71c544ff4c907bc5863702648cf36e4Christian Maeder REL="Help"
1e3950d5c1f0e041dd7677856e43f07796567d5bChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder<A
948f37fdb71c544ff4c907bc5863702648cf36e4Christian Maeder HREF="directive-dict.html#Override"
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder REL="Help"
be43c3fa0292555bd126784ae27ff5c1d23438cbChristian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder<A
1e3950d5c1f0e041dd7677856e43f07796567d5bChristian Maeder HREF="directive-dict.html#Status"
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder REL="Help"
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder><STRONG>Status:</STRONG></A> Base<BR>
f3faf4e4346b6224a3aaeeac11bac8b5c8932a29Christian Maeder<A
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder HREF="directive-dict.html#Module"
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder REL="Help"
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder><STRONG>Module:</STRONG></A> mod_mime
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder<P>AddHandler maps the filename extensions <EM>extension</EM> to the
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<A HREF="/handler.html">handler</A> <EM>handler-name</EM>. This
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maedermapping is added to any already in force, overriding any mappings that
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maederalready exist for the same <EM>extension</EM>.
1f315f2e146d15c0aec01f7ae076708bbac29796Christian Maeder
ef2affdc0cdf3acd5c051597c04ab9b08a346a7dChristian MaederFor example, to activate CGI scripts
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederwith the file extension "<CODE>.cgi</CODE>", you might use:
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder<PRE>
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder AddHandler cgi-script .cgi
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder</PRE>
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maeder<P>Once that has been put into your srm.conf or httpd.conf file, any
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maederfile containing the "<CODE>.cgi</CODE>" extension will be treated as a
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian MaederCGI program.</P>
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maeder
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maederbe specified with or without a leading dot.</p>
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder
f3faf4e4346b6224a3aaeeac11bac8b5c8932a29Christian Maeder<P>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
16023c23c9d17743033afd994ad11c386d17b376Christian Maedermultiple extensions</A>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<HR>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder<H2><A NAME="addlanguage">AddLanguage</A> directive</H2>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<!--%plaintext &lt;?INDEX {\tt AddLanguage} directive&gt; -->
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder<A
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder HREF="directive-dict.html#Syntax"
4a8f990902448d0562fbe1a98ce685ddbd531d38Christian Maeder REL="Help"
4a8f990902448d0562fbe1a98ce685ddbd531d38Christian Maeder><STRONG>Syntax:</STRONG></A> AddLanguage <EM>MIME-lang extension</em>
4a8f990902448d0562fbe1a98ce685ddbd531d38Christian Maeder [<em>extension</EM>] ...<BR>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<A
46947810076241f06f3e2919edb2289ed84d6c15Christian Maeder HREF="directive-dict.html#Context"
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder REL="Help"
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<A
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder HREF="directive-dict.html#Override"
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder REL="Help"
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder<A
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder HREF="directive-dict.html#Status"
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu REL="Help"
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu><STRONG>Status:</STRONG></A> Base<BR>
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu<A
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu HREF="directive-dict.html#Module"
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu REL="Help"
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder><STRONG>Module:</STRONG></A> mod_mime
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<P>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian MaederThe AddLanguage directive maps the given filename extensions to the
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederspecified content language. <EM>MIME-lang</EM> is the MIME language of
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederfilenames containing <EM>extension</EM>. This mapping is added to any
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maederalready in force, overriding any mappings that already exist for the
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescusame <EM>extension</EM>.
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu</P>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<P>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian MaederExample: <BLOCKQUOTE><CODE>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian MaederAddEncoding x-compress .Z<BR> AddLanguage en .en<BR> AddLanguage fr
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder.fr<BR> </CODE></BLOCKQUOTE>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu</P>
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu<P>
32647be84c5f21615df50b202bb0ea689e65500cMihai CodescuThen the document <CODE>xxxx.en.Z</CODE> will be treated as being a
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maedercompressed English document (as will the document
23a0c19ea8d6075fc765c64a20c70b119434823aMihai Codescu<CODE>xxxx.Z.en</CODE>). Although the content language is reported to
23a0c19ea8d6075fc765c64a20c70b119434823aMihai Codescuthe client, the browser is unlikely to use this information. The
23a0c19ea8d6075fc765c64a20c70b119434823aMihai CodescuAddLanguage directive is more useful for
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder<A HREF="/content-negotiation.html">content negotiation</A>, where
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maederthe server returns one from several documents based on the client's
23a0c19ea8d6075fc765c64a20c70b119434823aMihai Codesculanguage preference.
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder</P>
23a0c19ea8d6075fc765c64a20c70b119434823aMihai Codescu<P>
54d25074b7ddc5534322f0627e54a51e66568c14Christian MaederIf multiple language assignments are made for the same extension,
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maederthe last one encountered is the one that is used. That is, for the
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescucase of:
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu</P>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<PRE>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder AddLanguage en .en
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder AddLanguage en-uk .en
1f315f2e146d15c0aec01f7ae076708bbac29796Christian Maeder AddLanguage en-us .en
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu</PRE>
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu<P>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescudocuments with the extension "<CODE>.en</CODE>" would be treated as
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederbeing "<CODE>en-us</CODE>".
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder</P>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederbe specified with or without a leading dot.</p>
b03274844ecd270f9e9331f51cc4236a33e2e671Christian Maeder
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<P>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maedermultiple extensions</A>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<BR>
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu<STRONG>See also</STRONG>: <A
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai CodescuHREF="/mod_negotiation.html">mod_negotiation</A>
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu</P>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<HR>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<H2><A NAME="setfilter">SetFilter</A> directive</H2>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<!--%plaintext &lt;?INDEX {\tt SetFilter} directive&gt; -->
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<A
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu HREF="directive-dict.html#Syntax"
54d25074b7ddc5534322f0627e54a51e66568c14Christian Maeder REL="Help"
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu><STRONG>Syntax:</STRONG></A> SetFilter <em>MIME-type filter</em>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder [<em>filter</em>] ...<br>
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maeder<A
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder HREF="directive-dict.html#Context"
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder REL="Help"
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder<A
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder HREF="directive-dict.html#Override"
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder REL="Help"
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder<A
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder HREF="directive-dict.html#Status"
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder REL="Help"
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder><STRONG>Status:</STRONG></A> Base<BR>
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder<A
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder HREF="directive-dict.html#Module"
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder REL="Help"
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder><STRONG>Module:</STRONG></A> mod_mime
1f2332c370e11e77b36718b96d05e2b180bb3bebChristian Maeder
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<P>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian MaederThe SetFilter directive maps a filter stack to the specified MIME-type.
8fcb35320a5bacb7a8649bd0a26d3ac1a14e2008Ewaryst Schulz</P>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<P>
c35969f341eb137848e9c0874503bed8c419cbd2Kristina SojakovaExample: <BLOCKQUOTE><CODE>
c35969f341eb137848e9c0874503bed8c419cbd2Kristina SojakovaSetFilter server-parsed INCLUDES CACHE
c35969f341eb137848e9c0874503bed8c419cbd2Kristina Sojakova</CODE></BLOCKQUOTE>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder</P>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<P>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian MaederThen any document with the server-parsed MIME-type will pass through the
16023c23c9d17743033afd994ad11c386d17b376Christian MaederINCLUDES and CACHE filters. The filters are added in the same order that
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maederthey are specified in the config file.
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder</P>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<P>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian MaederThis can be very powerful when combined with the <A HREF="#addtype">
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian MaederAddType</A> directive. This allows you to specify an extension for a
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian MaederMIME-type and a set of filters for files with those extensions to be passed
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maederthrough
1b05bdb88b90d3c947351f262d7ae7d68f0a4a6fTill Mossakowski</P>
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder<PRE>
16023c23c9d17743033afd994ad11c386d17b376Christian MaederSetFilter text/html INCLUDES
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder</PRE>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<P>
16023c23c9d17743033afd994ad11c386d17b376Christian Maederdocuments with the extension "<CODE>.shtml</CODE>" would be passed through
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maederthe INCLUDES filter.
ef2affdc0cdf3acd5c051597c04ab9b08a346a7dChristian Maeder</P>
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder<P>
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder<HR>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder<H2><A NAME="addtype">AddType</A> directive</H2>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<!--%plaintext &lt;?INDEX {\tt AddType} directive&gt; -->
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder<A
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder HREF="directive-dict.html#Syntax"
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder REL="Help"
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder><STRONG>Syntax:</STRONG></A> AddType <EM>MIME-type extension</em>
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder [<em>extension</EM>] ...<BR>
996a56a455d65cfac4ddedd44fd90cfc1ea849aeChristian Maeder<A
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder HREF="directive-dict.html#Context"
ef2affdc0cdf3acd5c051597c04ab9b08a346a7dChristian Maeder REL="Help"
d6ee14efd13f136be5a2b03b7f27dc77aa52c754Christian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
d6ee14efd13f136be5a2b03b7f27dc77aa52c754Christian Maeder<A
d6ee14efd13f136be5a2b03b7f27dc77aa52c754Christian Maeder HREF="directive-dict.html#Override"
d6ee14efd13f136be5a2b03b7f27dc77aa52c754Christian Maeder REL="Help"
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
d6ee14efd13f136be5a2b03b7f27dc77aa52c754Christian Maeder<A
38e6a7281140deb96436868d396e1a0a3c934c2cChristian Maeder HREF="directive-dict.html#Status"
8528053a6a766c3614276df0f59fb2a2e8ab6d18Christian Maeder REL="Help"
2afae0880da7ca73c9376fd4d653ab19833fe858Christian Maeder><STRONG>Status:</STRONG></A> Base<BR>
ff21411cdf7c6d8d3acebbdebeade1d5ac502b83Christian Maeder<A
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder HREF="directive-dict.html#Module"
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maeder REL="Help"
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maeder><STRONG>Module:</STRONG></A> mod_mime<P>
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maeder
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian MaederThe AddType directive maps the given filename extensions onto the
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maederspecified content type. <EM>MIME-enc</EM> is the MIME type to use for
16023c23c9d17743033afd994ad11c386d17b376Christian Maederfilenames containing <EM>extension</EM>. This mapping is added to any
16023c23c9d17743033afd994ad11c386d17b376Christian Maederalready in force, overriding any mappings that already exist for the
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maedersame <EM>extension</EM>. This directive can be used to add mappings
1f315f2e146d15c0aec01f7ae076708bbac29796Christian Maedernot listed in the MIME types file (see the <CODE><A
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian MaederHREF="#typesconfig">TypesConfig</A></CODE> directive).
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maeder
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian MaederExample:
3bcf8bbafdda23d3c6be2deec9e68f98223b78c1Christian Maeder<BLOCKQUOTE><CODE>
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian MaederAddType image/gif .gif
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maeder</CODE></BLOCKQUOTE>
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian MaederIt is recommended that new MIME types be added using the AddType directive
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian Maederrather than changing the <A HREF="#typesconfig">TypesConfig</A> file.<P>
3ea571db6dd6e0c42d02de4e56648c7cd86a3734Christian MaederNote that, unlike the NCSA httpd, this directive cannot be used to set the
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maedertype of particular files.<P>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
16023c23c9d17743033afd994ad11c386d17b376Christian Maederbe specified with or without a leading dot.</p>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<P>
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder
e5fae0f42a23c12fce5389f405659d4e5dce73a4Christian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
16023c23c9d17743033afd994ad11c386d17b376Christian Maedermultiple extensions</A>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder
e5fae0f42a23c12fce5389f405659d4e5dce73a4Christian Maeder<HR>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<H2><A NAME="defaultlanguage">DefaultLanguage</A> directive</H2>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<!--%plaintext &lt;?INDEX {\tt DefaultLanguage} directive&gt; -->
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<A
5c13d1acd6298569a5574c07c833cd3fdac4ae4cChristian Maeder HREF="directive-dict.html#Syntax"
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder REL="Help"
c616e681da8c052b62e14247fea522da099ac0e4Christian Maeder><STRONG>Syntax:</STRONG></A> DefaultLanguage <EM>MIME-lang</EM><BR>
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder<A
89ab08979dc23d72e9e09c8990a8c44847041d6fChristian Maeder HREF="directive-dict.html#Context"
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder REL="Help"
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<A
c616e681da8c052b62e14247fea522da099ac0e4Christian Maeder HREF="directive-dict.html#Override"
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder REL="Help"
c35969f341eb137848e9c0874503bed8c419cbd2Kristina Sojakova><STRONG>Override:</STRONG></A> FileInfo<BR>
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<A
c35969f341eb137848e9c0874503bed8c419cbd2Kristina Sojakova HREF="directive-dict.html#Status"
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder REL="Help"
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder><STRONG>Status:</STRONG></A> Base<BR>
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder<A
d21dd452cd68abade683103a5c0cfe6d02c5f17bTill Mossakowski HREF="directive-dict.html#Module"
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder REL="Help"
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder><STRONG>Module:</STRONG></A> mod_mime
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai CodescuThe DefaultLanguage directive tells Apache that all files in the
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maederdirective's scope (<EM>e.g.</EM>, all files covered by the current
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder<CODE>&lt;Directory&gt;</CODE> container) that don't have an explicit
b9804822fb178b0fc27ce967a6a8cedc42c5bf90Christian Maederlanguage extension (such as <SAMP>.fr</SAMP> or <SAMP>.de</SAMP> as
cc5f3c5391fbe9d1274e3a3afb1dc458bb424ba5Christian Maederconfigured by <SAMP>AddLanguage</SAMP>) should be considered to be in
c2cd56b00fe132c78b9f4f86dbc2ab757dbc59ddChristian Maederthe specified <EM>MIME-lang</EM> language. This allows entire
84a30e66aef85cc54d3dd6f8e408729007fe8809Christian Maederdirectories to be marked as containing Dutch content, for instance,
cc5f3c5391fbe9d1274e3a3afb1dc458bb424ba5Christian Maederwithout having to rename each file. Note that unlike using extensions
cc5f3c5391fbe9d1274e3a3afb1dc458bb424ba5Christian Maederto specify languages, <SAMP>DefaultLanguage</SAMP> can only specify a
cc5f3c5391fbe9d1274e3a3afb1dc458bb424ba5Christian Maedersingle language.
edd35c6c970fa1707dc6ad7a3ba26119e0046223Cui Jian
84a30e66aef85cc54d3dd6f8e408729007fe8809Christian Maeder<P>
2c08058468dab64c89a8eae51b56f9afb8b6cb71Cui Jian
84a30e66aef85cc54d3dd6f8e408729007fe8809Christian MaederIf no <SAMP>DefaultLanguage</SAMP> directive is in force, and a file
cc5f3c5391fbe9d1274e3a3afb1dc458bb424ba5Christian Maederdoes not have any language extensions as configured by
84a30e66aef85cc54d3dd6f8e408729007fe8809Christian Maeder<SAMP>AddLanguage</SAMP>, then that file will be considered to have no
cd34f330714d6b3ef21a314ea98842c4b8c2fcedCui Jianlanguage attribute.
37e30366abd83c00a5d5447b45694627fd783de8Cui Jian
37e30366abd83c00a5d5447b45694627fd783de8Cui Jian<P>
37e30366abd83c00a5d5447b45694627fd783de8Cui Jian
37e30366abd83c00a5d5447b45694627fd783de8Cui Jian<STRONG>See also</STRONG>: <A
c2cd56b00fe132c78b9f4f86dbc2ab757dbc59ddChristian MaederHREF="/mod_negotiation.html">mod_negotiation</A>
cd34f330714d6b3ef21a314ea98842c4b8c2fcedCui Jian<BR>
5efed683fd173e9d53bd5f1929ba5b0c8a228710Christian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
876bd2c70a93981cc80f8376284616bce4a0fefcChristian Maedermultiple extensions</A>
da955132262baab309a50fdffe228c9efe68251dCui Jian
da955132262baab309a50fdffe228c9efe68251dCui Jian<HR>
5efed683fd173e9d53bd5f1929ba5b0c8a228710Christian Maeder
c2cd56b00fe132c78b9f4f86dbc2ab757dbc59ddChristian Maeder<H2><A NAME="forcetype">ForceType</A> directive</H2>
2c08058468dab64c89a8eae51b56f9afb8b6cb71Cui Jian
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder<A
2d2826f9db2c17275f91b0104940a60a2f9fd44dChristian Maeder HREF="directive-dict.html#Syntax"
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder REL="Help"
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder><STRONG>Syntax:</STRONG></A> ForceType <EM>media-type</EM><BR>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder<A
2d2826f9db2c17275f91b0104940a60a2f9fd44dChristian Maeder HREF="directive-dict.html#Context"
ef2affdc0cdf3acd5c051597c04ab9b08a346a7dChristian Maeder REL="Help"
22250d2b3c9f86fe19cba665d71c301de03db142Christian Maeder><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<A
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder HREF="directive-dict.html#Status"
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder REL="Help"
22250d2b3c9f86fe19cba665d71c301de03db142Christian Maeder><STRONG>Status:</STRONG></A> Base<BR>
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<A
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder HREF="directive-dict.html#Module"
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder REL="Help"
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder><STRONG>Module:</STRONG></A> mod_mime
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<P>When placed into an <CODE>.htaccess</CODE> file or a
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<CODE>&lt;Directory&gt;</CODE> or <CODE>&lt;Location&gt;</CODE> section,
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maederthis directive forces all matching files to be served
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maederas the content type given by <EM>media type</EM>. For example, if you
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maederhad a directory full of GIF files, but did not want to label them all with
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder".gif", you might want to use:
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<PRE>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder ForceType image/gif
7688e20f844fe88f75c04016841ebb5e5e3d927fChristian Maeder</PRE>
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<P>Note that this will override any filename extensions that might determine
22250d2b3c9f86fe19cba665d71c301de03db142Christian Maederthe media type.</P><HR>
22250d2b3c9f86fe19cba665d71c301de03db142Christian Maeder
7688e20f844fe88f75c04016841ebb5e5e3d927fChristian Maeder<H2><A NAME="removehandler">RemoveHandler</A> directive</H2>
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> RemoveHandler <EM>extension</em>
[<em>extension</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
<P>
The <SAMP>RemoveHandler</SAMP> directive removes any
handler associations for files with the given extensions.
This allows <CODE>.htaccess</CODE> files in subdirectories to undo
any associations inherited from parent directories or the server
config files. An example of its use might be:
</P>
<DL>
<DT><CODE>/foo/.htaccess:</CODE></DT>
<DD><CODE>AddHandler server-parsed .html</CODE></DD>
<DT><CODE>/foo/bar/.htaccess:</CODE></DT>
<DD><CODE>RemoveHandler .html</CODE></DD>
</DL>
<P>
This has the effect of returning <SAMP>.html</SAMP> files in the
<SAMP>/foo/bar</SAMP> directory to being treated as normal
files, rather than as candidates for parsing (see the
<A HREF="mod_include.html"><SAMP>mod_include</SAMP></A> module).
</P>
<p>The <em>extension</em> argument is case-insensitive, and can
be specified with or without a leading dot.</p>
<HR>
<H2><A NAME="sethandler">SetHandler</A> directive</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
<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> directive</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>