mod_mime.html revision 1997e02bed99bd0c081962ade257a0ea12ebe15b
7968d3a131e5a684ec1ff0c6d88aae638549153dChristian Maeder<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder BGCOLOR="#FFFFFF"
e6d40133bc9f858308654afb1262b8b483ec5922Till Mossakowski TEXT="#000000"
679d3f541f7a9ede4079e045f7758873bb901872Till Mossakowski LINK="#0000FF"
679d3f541f7a9ede4079e045f7758873bb901872Till Mossakowski VLINK="#000080"
306763c67bb99228487345b32ab8c5c6cd41f23cChristian Maeder ALINK="#FF0000"
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<!--#include virtual="header.html" -->
0fe1b901cec27c06b8aad7548f56a7cab4dee6a4Till Mossakowski<p>This module provides for determining the types of files
fa1efeb55163f27f261d22a9062fbc25ab4d8d52Michael Chanfrom the filename and for association of handlers with files.</p>
d420c2a27c4dfa0a9c8031449db2e1a89ad2cc3aChristian MaederHREF="module-dict.html#SourceFile"
697e63e30aa3c309a1ef1f9357745111f8dfc5a9Christian Maeder><STRONG>Source File:</STRONG></A> mod_mime.c
ec25781c1180ea07f66b48c34f93cf5634e9277cChristian MaederHREF="module-dict.html#ModuleIdentifier"
e182d0ec56025d97d74829cac75ee31eec12b093Maciek Makowski><STRONG>Module Identifier:</STRONG></A> mime_module
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.
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.
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.
f20841e0b3d9311fd39f2615e43538214f720dd5Kristina Sojakova<li><a href="#addcharset">AddCharset</a></li>
1b05bdb88b90d3c947351f262d7ae7d68f0a4a6fTill Mossakowski<LI><A HREF="#defaultlanguage">DefaultLanguage</A>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder<LI><A HREF="#removehandler">RemoveHandler</A>
2a0562f417902e59161fe6a2173fdc8aa3877616Christian Maederhref="mod_mime_magic.html#mimemagicfile">MimeMagicFile</a>.</p>
21dae7237ac384abdb94a81e00b3f099873ec623Till Mossakowski<H2><A NAME="multipleext">Files with Multiple Extensions</A></H2>
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
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".
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.
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>
99d38db8cb1b6528b5ee07e06507d7a7b3ef2fdeChristian Maeder<A HREF="directive-dict.html#Context" REL="Help"
e1a13f91fd3074f2e4b9c6fd1933787d2ad9e753Christian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
4cbba4634ba267c438f75fa7a5009f6249d3dda1Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
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
21dae7237ac384abdb94a81e00b3f099873ec623Till Mossakowski AddLanguage ja .ja
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder AddCharset EUC-JP .euc
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maeder AddCharset ISO-2022-JP .jis
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian Maeder AddCharset SHIFT_JIS .sjis
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.
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian Maederbe specified with or without a leading dot.</p>
be8b8876edf3d7138ddd39a4ec07d857dde5bbb5Christian Maeder<STRONG>See also</STRONG>: <A HREF="mod_negotiation.html">mod_negotiation</A>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<H2><A NAME="addencoding">AddEncoding</A> directive</H2>
7f7460e7095628f3437b116ee78d3043d11f8febChristian Maeder<!--%plaintext <?INDEX {\tt AddEncoding} directive> -->
b83ff3749d99d03b641adee264b781039a551addChristian Maeder><STRONG>Syntax:</STRONG></A> AddEncoding <EM>MIME-enc extension</em>
17d4f8c5576d93f36cafe68161cdb960ec49ce7cChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
f1d04fe5072b827d9cc490ebdbca78108241a392Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
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
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian MaederAddEncoding x-gzip .gz<BR>
e49fd57c63845c7806860a9736ad09f6d44dbaedChristian MaederAddEncoding x-compress .Z
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>
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>.
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<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
4d1386a4e547d8676886fdd2117dabd0fe035e6aChristian Maedermultiple extensions</A>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder<H2><A NAME="addhandler">AddHandler</A> directive</H2>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder><STRONG>Syntax:</STRONG></A> AddHandler <EM>handler-name extension</em>
1e3950d5c1f0e041dd7677856e43f07796567d5bChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
be43c3fa0292555bd126784ae27ff5c1d23438cbChristian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
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>.
ef2affdc0cdf3acd5c051597c04ab9b08a346a7dChristian MaederFor example, to activate CGI scripts
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederwith the file extension "<CODE>.cgi</CODE>", you might use:
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder AddHandler cgi-script .cgi
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<p>The <em>extension</em> argument is case-insensitive, and can
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maederbe specified with or without a leading dot.</p>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
16023c23c9d17743033afd994ad11c386d17b376Christian Maedermultiple extensions</A>
5a87ed846cc38cb0e3adf8f736d95614d3e724a3Christian Maeder<H2><A NAME="addlanguage">AddLanguage</A> directive</H2>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<!--%plaintext <?INDEX {\tt AddLanguage} directive> -->
4a8f990902448d0562fbe1a98ce685ddbd531d38Christian Maeder><STRONG>Syntax:</STRONG></A> AddLanguage <EM>MIME-lang extension</em>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
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
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian MaederAddEncoding x-compress .Z<BR> AddLanguage en .en<BR> AddLanguage fr
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 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
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder AddLanguage en .en
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder AddLanguage en-uk .en
1f315f2e146d15c0aec01f7ae076708bbac29796Christian Maeder AddLanguage en-us .en
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescudocuments with the extension "<CODE>.en</CODE>" would be treated as
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder<p>The <em>extension</em> argument is case-insensitive, and can
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maederbe specified with or without a leading dot.</p>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maedermultiple extensions</A>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai CodescuHREF="/mod_negotiation.html">mod_negotiation</A>
ddd8734e5b3802a1a6c908af6b1e870af76c932dChristian Maeder<H2><A NAME="setfilter">SetFilter</A> directive</H2>
28cbeb7eb61216d3b5a27dca176333d1ff8d3357Mihai Codescu<!--%plaintext <?INDEX {\tt SetFilter} directive> -->
32647be84c5f21615df50b202bb0ea689e65500cMihai Codescu><STRONG>Syntax:</STRONG></A> SetFilter <em>MIME-type filter</em>
4b0e0613129ebfc53e3e87985c20a537da91d18dChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
54fb645be0a806e7fd3c0eed5691c2153eb8d518Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
a2e1df1a654e9f683373245b6fbfc5f415842eb5Christian MaederThe SetFilter directive maps a filter stack to the specified MIME-type.
c35969f341eb137848e9c0874503bed8c419cbd2Kristina SojakovaSetFilter server-parsed INCLUDES CACHE
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 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
16023c23c9d17743033afd994ad11c386d17b376Christian Maederdocuments with the extension "<CODE>.shtml</CODE>" would be passed through
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maederthe INCLUDES filter.
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder<H2><A NAME="addtype">AddType</A> directive</H2>
c092fcac4b8f5c524c22ca579189c4487c13edf7Christian Maeder<!--%plaintext <?INDEX {\tt AddType} directive> -->
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder><STRONG>Syntax:</STRONG></A> AddType <EM>MIME-type extension</em>
d6ee14efd13f136be5a2b03b7f27dc77aa52c754Christian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
fb7c3ffc41767729db506ad0ac1262ecfb5febf8Christian Maeder><STRONG>Override:</STRONG></A> FileInfo<BR>
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).
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<p>The <em>extension</em> argument is case-insensitive, and can
16023c23c9d17743033afd994ad11c386d17b376Christian Maederbe specified with or without a leading dot.</p>
e5fae0f42a23c12fce5389f405659d4e5dce73a4Christian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
16023c23c9d17743033afd994ad11c386d17b376Christian Maedermultiple extensions</A>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<H2><A NAME="defaultlanguage">DefaultLanguage</A> directive</H2>
16023c23c9d17743033afd994ad11c386d17b376Christian Maeder<!--%plaintext <?INDEX {\tt DefaultLanguage} directive> -->
c616e681da8c052b62e14247fea522da099ac0e4Christian Maeder><STRONG>Syntax:</STRONG></A> DefaultLanguage <EM>MIME-lang</EM><BR>
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR>
c35969f341eb137848e9c0874503bed8c419cbd2Kristina Sojakova><STRONG>Override:</STRONG></A> FileInfo<BR>
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><Directory></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.
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.
c2cd56b00fe132c78b9f4f86dbc2ab757dbc59ddChristian MaederHREF="/mod_negotiation.html">mod_negotiation</A>
5efed683fd173e9d53bd5f1929ba5b0c8a228710Christian Maeder<STRONG>See also</STRONG>: <A HREF="#multipleext">Files with
876bd2c70a93981cc80f8376284616bce4a0fefcChristian Maedermultiple extensions</A>
c2cd56b00fe132c78b9f4f86dbc2ab757dbc59ddChristian Maeder<H2><A NAME="forcetype">ForceType</A> directive</H2>
95c3e5d11dcee331dc3876a9bf0c1d6daa38e2caChristian Maeder><STRONG>Syntax:</STRONG></A> ForceType <EM>media-type</EM><BR>
22250d2b3c9f86fe19cba665d71c301de03db142Christian Maeder><STRONG>Context:</STRONG></A> directory, .htaccess<BR>
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<P>When placed into an <CODE>.htaccess</CODE> file or a
3d4e57e86d8aee818b589cd1029838e0accade55Christian Maeder<CODE><Directory></CODE> or <CODE><Location></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<P>Note that this will override any filename extensions that might determine
7688e20f844fe88f75c04016841ebb5e5e3d927fChristian Maeder<H2><A NAME="removehandler">RemoveHandler</A> directive</H2>
HREF="directive-dict.html#Syntax"
HREF="directive-dict.html#Context"
HREF="directive-dict.html#Status"
HREF="directive-dict.html#Module"
HREF="directive-dict.html#Syntax"
HREF="directive-dict.html#Context"
HREF="directive-dict.html#Status"
HREF="directive-dict.html#Module"
called, you might put the following into access.conf:
HREF="directive-dict.html#Syntax"
HREF="directive-dict.html#Default"
HREF="directive-dict.html#Context"
HREF="directive-dict.html#Status"
HREF="directive-dict.html#Module"
<!--#include virtual="footer.html" -->