1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 --><title>mod_mime - Apache HTTP Server</title><link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body><div id="page-header"><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div><div id="page-content"><div id="preamble"><h1>Apache Module mod_mime</h1><table class="module"><tr><th>Description:
8 </th><td>Associates the requested filename's extensions
9 with the file's behavior (handlers and filters)
10 and content (mime-type, language, character set and
11 encoding)</td></tr><tr><th><a href="module-dict.html#Status">Status:
12 </a></th><td>Base</td></tr><tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:
13 </a></th><td>mime_module</td></tr></table><h3>Summary</h3>
14 <p>This module is used to associate various bits of "meta
15 information" with files by their filename extensions. This
16 information relates the filename of the document to it's
17 mime-type, language, character set and encoding. This
18 information is sent to the browser, and participates in content
19 negotiation, so the user's preferences are respected when
20 choosing one of several possible files to serve. See
21 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code> for more information
22 about content negotiation. </p>
24 <p>The directives <code class="directive"><a href="#addcharset">AddCharset</a></code>, <code class="directive"><a href="#addencoding">AddEncoding</a></code>, <code class="directive"><a href="#addlanguage">AddLanguage</a></code> and <code class="directive"><a href="#addtype">AddType</a></code> are all used to map file
25 extensions onto the meta-information for that file. Respectively
26 they set the character set, content-encoding, content-language,
27 and MIME-type (content-type) of documents. The directive <code class="directive"><a href="#typesconfig">TypesConfig</a></code> is used to specify a
28 file which also maps extensions onto MIME types. </p>
30 <p>In addition, <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> may define the <a href="../handler.html">handler</a> and <a href="../filter.html">filters</a> that originate and process
31 content. The directives <code class="directive"><a href="#addhandler">AddHandler</a></code>, <code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code>, and <code class="directive"><a href="#addinputfilter">AddInputFilter</a></code> control the modules
32 or scripts that serve the document. The <code class="directive"><a href="#multiviewsmatch">MultiviewsMatch</a></code> directive allows
33 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code> to consider these file extensions
34 to be included when testing Multiviews matches.</p>
36 <p>While <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> associates meta-information
37 with filename extensions, the <code class="module"><a href="../mod/core.html">core</a></code> server
38 provides directives that are used to associate all the files in a
39 given container (<em>e.g.</em>, <code class="directive"><a href="../mod/core.html#location"><location></a></code>, <code class="directive"><a href="../mod/core.html#directory"><directory></a></code>, or <code class="directive"><a href="../mod/core.html#files"><Files></a></code>) with particular
40 meta-information. These directives include <code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code>, <code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code>, <code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code>, and <code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code>. The core directives
41 override any filename extension mappings defined in
42 <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code>.</p>
44 <p>Note that changing the meta-information for a file does not
45 change the value of the <code>Last-Modified</code> header.
46 Thus, previously cached copies may still be used by a client or
47 proxy, with the previous headers. If you change the
48 meta-information (language, content type, character set or
49 encoding) you may need to 'touch' affected files (updating
50 their last modified date) to ensure that all visitors are
51 receive the corrected content headers.</p>
52 </div><div id="quickview"><h3 class="directives">Directives</h3><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#addcharset">AddCharset</a></li><li><img alt="" src="../images/down.gif" /> <a href="#addencoding">AddEncoding</a></li><li><img alt="" src="../images/down.gif" /> <a href="#addhandler">AddHandler</a></li><li><img alt="" src="../images/down.gif" /> <a href="#addinputfilter">AddInputFilter</a></li><li><img alt="" src="../images/down.gif" /> <a href="#addlanguage">AddLanguage</a></li><li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilter">AddOutputFilter</a></li><li><img alt="" src="../images/down.gif" /> <a href="#addtype">AddType</a></li><li><img alt="" src="../images/down.gif" /> <a href="#defaultlanguage">DefaultLanguage</a></li><li><img alt="" src="../images/down.gif" /> <a href="#multiviewsmatch">MultiviewsMatch</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removecharset">RemoveCharset</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removeencoding">RemoveEncoding</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removehandler">RemoveHandler</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removeinputfilter">RemoveInputFilter</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removelanguage">RemoveLanguage</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removeoutputfilter">RemoveOutputFilter</a></li><li><img alt="" src="../images/down.gif" /> <a href="#removetype">RemoveType</a></li><li><img alt="" src="../images/down.gif" /> <a href="#typesconfig">TypesConfig</a></li></ul><h3>Topics</h3><ul id="topics"><li><img alt="" src="../images/down.gif" /> <a href="#multipleext">Files with Multiple Extensions</a></li><li><img alt="" src="../images/down.gif" /> <a href="#contentencoding">Content encoding</a></li><li><img alt="" src="../images/down.gif" /> Character sets and languages</li></ul><h3>See also</h3><ul class="seealso"><li><code class="directive"><a href="../mod/mod_mime_magic.html#mimemagicfile">MimeMagicFile</a></code></li><li><code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code></li><li><code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code></li><li><code class="directive"><a href="../mod/core.html#defaulttype">DefaultType</a></code></li><li><code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code></li><li><code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code></li><li><code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="multipleext" id="multipleext">Files with Multiple Extensions</a></h2>
55 <p>Files can have more than one extension, and the order of the
56 extensions is <em>normally</em> irrelevant. For example, if the
57 file <code>welcome.html.fr</code> maps onto content type
58 text/html and language French then the file <code>welcome.fr.html</code>
59 will map onto exactly the same information. If more than one
60 extension is given which maps onto the same
61 type of meta-information, then the one to the right will be
62 used. For example, if ".gif" maps to the MIME-type image/gif
63 and ".html" maps to the MIME-type text/html, then the file
64 <code>welcome.gif.html</code> will be associated with the
65 MIME-type "text/html".</p>
67 <p>Care should be taken when a file with multiple extensions
68 gets associated with both a MIME-type and a handler. This will
69 usually result in the request being by the module associated
70 with the handler. For example, if the <code>.imap</code>
71 extension is mapped to the handler "imap-file" (from mod_imap)
72 and the <code>.html</code> extension is mapped to the MIME-type
73 "text/html", then the file <code>world.imap.html</code> will be
74 associated with both the "imap-file" handler and "text/html"
75 MIME-type. When it is processed, the "imap-file" handler will
76 be used, and so it will be treated as a mod_imap imagemap
78 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="contentencoding" id="contentencoding">Content encoding</a></h2>
80 <p>A file of a particular MIME type can additionally be encoded a
81 particular way to simplify transmission over the Internet.
82 While this usually will refer to compression, such as
83 <code>gzip</code>, it can also refer to encryption, such a
84 <code>pgp</code> or to an encoding such as UUencoding, which is
85 designed for transmitting a binary file in an ASCII (text)
88 <p>The MIME RFC puts it this way:</p>
91 The Content-Encoding entity-header field is used as a
92 modifier to the media-type. When present, its value indicates
93 what additional content coding has been applied to the
94 resource, and thus what decoding mechanism must be applied in
95 order to obtain the media-type referenced by the Content-Type
96 header field. The Content-Encoding is primarily used to allow
97 a document to be compressed without losing the identity of
98 its underlying media type.
101 <p>By using more than one file extension (see <a href="#multipleext">section above about multiple file
102 extensions</a>), you can indicate that a file is of a
103 particular <em>type</em>, and also has a particular
104 <em>encoding</em>. </p>
106 <p>For example, you may have a file which is a Microsoft Word
107 document, which is pkzipped to reduce its size. If the
108 <code>.doc</code> extension is associated with the Microsoft
109 Word file type, and the <code>.zip</code> extension is
110 associated with the pkzip file encoding, then the file
111 <code>Resume.doc.zip</code>would be known to be a pkzip'ed Word
114 <p>Apache send a <code>Content-encoding</code> header with the
115 resource, in order to tell the client browser about the
118 <div class="example"><p><code>Content-encoding: pkzip</code></p></div>
120 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2>Character sets and languages</h2>
124 <p>In addition to file type and the file encoding,
125 another important piece of information is what language a
126 particular document is in, and in what character set the file
127 should be displayed. For example, the document might be written
128 in the Vietnamese alphabet, or in Cyrillic, and should be
129 displayed as such. This information, also, is transmitted in
132 <p>The character set, language encoding and mime type are all
133 used in the process of content negotiation (See
134 <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>) to determine
135 which document to give to the client, when there are
136 alternative documents in more than one character set, language,
137 encoding or mime type. All filename extensions associations
138 created with <code class="module"><a href="../mod/AddCharset.html">AddCharset</a></code>, <code class="module"><a href="../mod/AddEncoding.html">AddEncoding</a></code>,
139 <code class="module"><a href="../mod/AddLanguage.html">AddLanguage</a></code> and <code class="module"><a href="../mod/AddType.html">AddType</a></code> directives
140 (and extensions listed in the <code class="module"><a href="../mod/MimeMagicFile.html">MimeMagicFile</a></code>)
141 participate in this select process. Filename extensions that
142 are only associated using the <code class="module"><a href="../mod/AddHandler.html">AddHandler</a></code>,
143 <code class="module"><a href="../mod/AddInputFilter.html">AddInputFilter</a></code> or <code class="module"><a href="../mod/AddOutputFilter.html">AddOutputFilter</a></code>
144 directives may be included or excluded from matching by using
145 the <code class="directive">MultiviewsMatch</code> directive.</p>
150 <p>To convey this further information, Apache optionally sends
151 a <code>Content-Language</code> header, to specify the language
152 that the document is in, and can append additional information
153 onto the <code>Content-Type</code> header to indicate the
154 particular character set that should be used to correctly
155 render the information.</p>
157 <div class="example"><p><code>
158 Content-Language: en, fr<br />
159 Content-Type: text/plain; charset=ISO-8859-2
162 <p>The language specification is the two-letter abbreviation
163 for the language. The <code>charset</code> is the name of the
164 particular character set which should be used.</p>
166 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddCharset" id="AddCharset">AddCharset</a> <a name="addcharset" id="addcharset">Directive</a></h2><table class="directive"><tr><th>Description:
167 </th><td>Maps the given filename extensions
168 to the specified content charset</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
169 </a></th><td>AddCharset <em>charset extension</em>
170 [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
171 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
172 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
173 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
174 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
175 </a></th><td>AddCharset is only available in Apache
176 1.3.10 and later</td></tr></table>
178 <p>The AddCharset directive maps the given filename extensions
179 to the specified content charset. <em>charset</em> is the MIME
180 charset parameter of filenames containing <em>extension</em>.
181 This mapping is added to any already in force, overriding any
182 mappings that already exist for the same <em>extension</em>.</p>
185 <div class="example"><p><code>
186 AddLanguage ja .ja<br />
187 AddCharset EUC-JP .euc<br />
188 AddCharset ISO-2022-JP .jis<br />
189 AddCharset SHIFT_JIS .sjis
192 <p>Then the document <code>xxxx.ja.jis</code> will be treated
193 as being a Japanese document whose charset is ISO-2022-JP (as
194 will the document <code>xxxx.jis.ja</code>). The AddCharset
195 directive is useful for both to inform the client about the
196 character encoding of the document so that the document can be
197 interpreted and displayed appropriately, and for <a href="../content-negotiation.html">content negotiation</a>,
198 where the server returns one from several documents based on
199 the client's charset preference.</p>
201 <p>The <em>extension</em> argument is case-insensitive, and can
202 be specified with or without a leading dot.</p>
204 <h3>See also</h3><ul><li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li><li><code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddEncoding" id="AddEncoding">AddEncoding</a> <a name="addencoding" id="addencoding">Directive</a></h2><table class="directive"><tr><th>Description:
205 </th><td>Maps the given filename extensions
206 to the specified encoding type</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
207 </a></th><td>AddEncoding
208 <em>MIME-enc extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
209 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
210 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
211 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
212 </a></th><td>mod_mime</td></tr></table>
214 <p>The AddEncoding directive maps the given filename extensions
215 to the specified encoding type. <em>MIME-enc</em> is the MIME
216 encoding to use for documents containing the
217 <em>extension</em>. This mapping is added to any already in
218 force, overriding any mappings that already exist for the same
219 <em>extension</em>. Example:</p>
221 <div class="example"><p><code>
222 AddEncoding x-gzip .gz<br />
223 AddEncoding x-compress .Z
226 <p>This will cause filenames containing the .gz extension to be
227 marked as encoded using the x-gzip encoding, and filenames
228 containing the .Z extension to be marked as encoded with
231 <p>Old clients expect <code>x-gzip</code> and
232 <code>x-compress</code>, however the standard dictates that
233 they're equivalent to <code>gzip</code> and
234 <code>compress</code> respectively. Apache does content
235 encoding comparisons by ignoring any leading <code>x-</code>.
236 When responding with an encoding Apache will use whatever form
237 (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the
238 client requested. If the client didn't specifically request a
239 particular form Apache will use the form given by the
240 <code>AddEncoding</code> directive. To make this long story
241 short, you should always use <code>x-gzip</code> and
242 <code>x-compress</code> for these two specific encodings. More
243 recent encodings, such as <code>deflate</code> should be
244 specified without the <code>x-</code>.</p>
246 <p>The <em>extension</em> argument is case-insensitive, and can
247 be specified with or without a leading dot.</p>
249 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddHandler" id="AddHandler">AddHandler</a> <a name="addhandler" id="addhandler">Directive</a></h2><table class="directive"><tr><th>Description:
250 </th><td>Maps the filename extensions
251 to the specified handler</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
252 </a></th><td>AddHandler
253 <em>handler-name extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
254 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
255 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
256 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
257 </a></th><td>mod_mime</td></tr></table>
258 <p>Files having the name <em>extension</em> will be served by the
259 specified <a href="../handler.html">handler-name</a>. This mapping is
260 added to any already in force, overriding any mappings that already
261 exist for the same <em>extension</em>. For example, to activate CGI
262 scripts with the file extension "<code>.cgi</code>", you might
265 <div class="example"><p><code>
266 AddHandler cgi-script .cgi
269 <p>Once that has been put into your srm.conf or httpd.conf
270 file, any file containing the "<code>.cgi</code>" extension
271 will be treated as a CGI program.</p>
273 <p>The <em>extension</em> argument is case-insensitive, and can
274 be specified with or without a leading dot.</p>
276 <h3>See also</h3><ul><li><code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddInputFilter" id="AddInputFilter">AddInputFilter</a> <a name="addinputfilter" id="addinputfilter">Directive</a></h2><table class="directive"><tr><th>Description:
277 </th><td>Maps filename extensions
278 to the filters that will process
279 client requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
280 </a></th><td>AddInputFilter
281 <em>filter</em>[<em>;filter</em>...] extension
282 [<em>extension</em> ...]</td></tr><tr><th><a href="directive-dict.html#Context">Context:
283 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
284 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
285 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
286 </a></th><td>AddInputFilter
287 is only available in Apache 2.0.26 and later.</td></tr></table>
289 <p>AddInputFilter maps the filename extensions <em>extension</em>
290 to the <a href="../filter.html">filters</a> which will process
291 client requests and POST input when they are received by the
292 server. This is in addition to any filters defined elsewhere,
293 including the <a href="core.html#setinputfilter">SetInputFilter</a> directive.
294 This mapping is merged over any already in force, overriding any
295 mappings that already exist for the same <em>extension</em>.</p>
297 <p>If more than one filter is specified, they must be separated
298 by semicolons in the order in which they should process the
299 content. Both the filter and <em>extension</em> arguments are
300 case-insensitive, and the extension may be specified with or
301 without a leading dot.</p>
303 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddLanguage" id="AddLanguage">AddLanguage</a> <a name="addlanguage" id="addlanguage">Directive</a></h2><table class="directive"><tr><th>Description:
304 </th><td>Maps the given filename extension
305 to the specified content language</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
306 </a></th><td>AddLanguage
307 <em>MIME-lang extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
308 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
309 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
310 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
311 </a></th><td>mod_mime</td></tr></table>
313 <p>The AddLanguage directive maps the given filename extension
314 to the specified content language. <em>MIME-lang</em> is the
315 MIME language of filenames containing <em>extension</em>. This
316 mapping is added to any already in force, overriding any
317 mappings that already exist for the same
318 <em>extension</em>.</p>
322 <div class="example"><p><code>
323 AddEncoding x-compress .Z<br />
324 AddLanguage en .en<br />
328 <p>Then the document <code>xxxx.en.Z</code> will be treated as
329 being a compressed English document (as will the document
330 <code>xxxx.Z.en</code>). Although the content language is
331 reported to the client, the browser is unlikely to use this
332 information. The AddLanguage directive is more useful for <a href="../content-negotiation.html">content negotiation</a>,
333 where the server returns one from several documents based on
334 the client's language preference.</p>
336 <p>If multiple language assignments are made for the same
337 extension, the last one encountered is the one that is used.
338 That is, for the case of:</p>
340 <div class="example"><p><code>
341 AddLanguage en .en<br />
342 AddLanguage en-uk .en<br />
343 AddLanguage en-us .en
346 <p>documents with the extension "<code>.en</code>" would be
347 treated as being "<code>en-us</code>".</p>
349 <p>The <em>extension</em> argument is case-insensitive, and can
350 be specified with or without a leading dot.</p>
352 <h3>See also</h3><ul><li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddOutputFilter" id="AddOutputFilter">AddOutputFilter</a> <a name="addoutputfilter" id="addoutputfilter">Directive</a></h2><table class="directive"><tr><th>Description:
353 </th><td>maps the filename
354 extensions to the filters that will process
355 responses from the server</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
356 </a></th><td>AddOutputFilter
357 <em>filter</em>[<em>;filter</em>...] extension
358 [<em>extension</em> ...]</td></tr><tr><th><a href="directive-dict.html#Context">Context:
359 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
360 </a></th><td /></tr><tr><th><a href="directive-dict.html#Status">Status:
361 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
362 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
363 </a></th><td>AddOutputFilter
364 is only available in Apache 2.0.26 and later.</td></tr></table>
366 <p>The <code class="directive">AddOutputFilter</code> directive maps the
367 filename extensions <em>extension</em> to the <a href="../filter.html">filters</a> which will process responses
368 from the server before they are sent to the client. This is in
369 addition to any filters defined elsewhere, including the
370 <code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code>
371 directive. This mapping is merged over any already in force,
372 overriding any mappings that already exist for the same
373 <em>extension</em>.</p>
375 <p>For example, the following configuration will process all
376 .shtml files for server-side includes and will then compress
377 the output using <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>.</p>
380 <div class="example"><p><code>
381 AddOutputFilter INCLUDES;DEFLATE shtml
384 <p>If more than one filter is specified, they must be separated
385 by semicolons in the order in which they should process the
386 content. Both the filter and <em>extension</em> arguments are
387 case-insensitive, and the extension may be specified with or
388 without a leading dot.</p>
390 <h3>See also</h3><ul><li><code class="directive"><a href="#removeoutputfilter">RemoveOutputFilter</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddType" id="AddType">AddType</a> <a name="addtype" id="addtype">Directive</a></h2><table class="directive"><tr><th>Description:
391 </th><td>Maps the given filename extensions
392 onto the specified content type</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
393 </a></th><td>AddType <em>MIME-type
394 extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
395 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
396 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
397 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
398 </a></th><td>mod_mime</td></tr></table>
400 <p>The AddType directive maps the given filename extensions onto
401 the specified content type. <em>MIME-type</em> is the MIME type to
402 use for filenames containing <em>extension</em>. This mapping is
403 added to any already in force, overriding any mappings that
404 already exist for the same <em>extension</em>. This directive can
405 be used to add mappings not listed in the MIME types file (see the
406 <code class="directive"><a href="#typesconfig">TypesConfig</a></code>
411 <div class="example"><p><code>
412 AddType image/gif .gif
415 <div class="note">It is recommended that new MIME types be added using the
416 AddType directive rather than changing the
417 <code class="directive">TypesConfig</code> file. </div>
419 <p>The <em>extension</em> argument is case-insensitive, and can
420 be specified with or without a leading dot.</p>
422 <h3>See also</h3><ul><li><code class="directive"><a href="../mod/core.html#defaulttype">DefaultType</a></code></li><li><code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="DefaultLanguage" id="DefaultLanguage">DefaultLanguage</a> <a name="defaultlanguage" id="defaultlanguage">Directive</a></h2><table class="directive"><tr><th>Description:
423 </th><td>Sets all files in the given scope to the
424 specified language</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
425 </a></th><td>DefaultLanguage
426 <em>MIME-lang</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
427 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
428 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
429 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
430 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
431 </a></th><td>DefaultLanguage
432 is only available in Apache 1.3.4 and later.</td></tr></table>
434 <p>The DefaultLanguage directive tells Apache that all files in
435 the directive's scope (<em>e.g.</em>, all files covered by the
436 current <code><Directory></code> container) that don't
437 have an explicit language extension (such as <code>.fr</code>
438 or <code>.de</code> as configured by <code>AddLanguage</code>)
439 should be considered to be in the specified <em>MIME-lang</em>
440 language. This allows entire directories to be marked as
441 containing Dutch content, for instance, without having to
442 rename each file. Note that unlike using extensions to specify
443 languages, <code>DefaultLanguage</code> can only specify a
446 <p>If no <code>DefaultLanguage</code> directive is in force,
447 and a file does not have any language extensions as configured
448 by <code>AddLanguage</code>, then that file will be considered
449 to have no language attribute.</p>
451 <div class="example"><h3>Example</h3><p><code>
455 <h3>See also</h3><ul><li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="MultiviewsMatch" id="MultiviewsMatch">MultiviewsMatch</a> <a name="multiviewsmatch" id="multiviewsmatch">Directive</a></h2><table class="directive"><tr><th>Description:
456 </th><td>The types of files that will be included when
457 searching for a matching file with MultiViews</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
458 </a></th><td>MultiviewsMatch
459 <em>[NegotiatedOnly] [Handlers] [Filters] [Any]</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
460 </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
461 </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
462 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
463 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
464 </a></th><td>Available
465 in Apache 2.0.26 and later.</td></tr></table>
467 <p>MultiviewsMatch permits three different behaviors for
468 <a href="mod_negotiation.html">mod_negotiation</a>'s Multiviews
469 feature. Multiviews allows a request for a file, e.g. index.html,
470 to match any negotiated extensions following the base request,
471 e.g. index.html.en, index.html.fr, or index.html.gz.</p>
473 <p>The NegotiatedOnly option provides that every extension following
474 the base name must correlate to a recognized mod_mime extension for
475 content negotation, e.g. Charset, Content-Type, Language, or
476 Encoding. This is the strictest implementation with the fewest
477 unexpected side effects, and is the default behavior.</p>
479 <p>To include extensions associated with Handlers and/or Filters,
480 set the MultiviewsMatch directive to either Handlers, Filters, or
481 both option keywords. If all other factors are equal, the smallest
482 file will be served, e.g. in deciding between index.html.cgi of 500
483 characters and index.html.pl of 1000 bytes, the .cgi file would win
484 in this example. Users of .asis files might prefer to use the
485 Handler option, if .asis files are associated with the asis-handler.</p>
487 <p>You may finally allow Any extensions to match, even if mod_mime
488 doesn't recognize the extension. This was the behavior in Apache 1.3,
489 and can cause unpredicatable results, such as serving .old or .bak
490 files the webmaster never expected to be served.</p>
492 <p>For example, the following configuration will allow handlers
493 and filters to participate in Multviews, but will exclude unknown
495 <div class="example"><p><code>
496 MultiviewsMatch Handlers Filters
499 <h3>See also</h3><ul><li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveCharset" id="RemoveCharset">RemoveCharset</a> <a name="removecharset" id="removecharset">Directive</a></h2><table class="directive"><tr><th>Description:
500 </th><td>Removes any character set associations for a set of file
501 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
502 </a></th><td>RemoveCharset
503 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
504 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
505 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
506 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
507 </a></th><td>RemoveCharset is
508 only available in Apache 2.0.24 and later.</td></tr></table>
509 <p>The <code>RemoveCharset</code> directive removes any
510 character set associations for files with the given extensions.
511 This allows <code>.htaccess</code> files in subdirectories to
512 undo any associations inherited from parent directories or the
513 server config files.</p>
515 <p>The <em>extension</em> argument is case-insensitive, and can
516 be specified with or without a leading dot.</p>
518 <div class="example"><h3>Example</h3><p><code>
519 RemoveCharset .html .shtml
522 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveEncoding" id="RemoveEncoding">RemoveEncoding</a> <a name="removeencoding" id="removeencoding">Directive</a></h2><table class="directive"><tr><th>Description:
523 </th><td>Removes any content encoding associations for a set of file
524 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
525 </a></th><td>RemoveEncoding
526 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
527 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
528 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
529 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
530 </a></th><td>RemoveEncoding
531 is only available in Apache 1.3.13 and later.</td></tr></table>
533 <p>The <code>RemoveEncoding</code> directive removes any
534 encoding associations for files with the given extensions. This
535 allows <code>.htaccess</code> files in subdirectories to undo
536 any associations inherited from parent directories or the
537 server config files. An example of its use might be:</p>
540 <div class="example"><h3>/foo/.htaccess:</h3><pre>
541 AddEncoding x-gzip .gz
542 AddType text/plain .asc
543 <Files *.gz.asc>
548 <p>This will cause <code>foo.gz</code> to be marked as being
549 encoded with the gzip method, but <code>foo.gz.asc</code> as an
550 unencoded plaintext file.</p>
552 <p><strong>Note:</strong>RemoveEncoding directives are processed
553 <em>after</em> any AddEncoding directives, so it is possible they
554 may undo the effects of the latter if both occur within the
555 same directory configuration.</p>
557 <p>The <em>extension</em> argument is case-insensitive, and can
558 be specified with or without a leading dot.</p>
559 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveHandler" id="RemoveHandler">RemoveHandler</a> <a name="removehandler" id="removehandler">Directive</a></h2><table class="directive"><tr><th>Description:
560 </th><td>Removes any handler associations for a set of file
561 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
562 </a></th><td>RemoveHandler
563 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
564 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
565 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
566 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
567 </a></th><td>RemoveHandler is
568 only available in Apache 1.3.4 and later.</td></tr></table>
570 <p>The <code>RemoveHandler</code> directive removes any handler
571 associations for files with the given extensions. This allows
572 <code>.htaccess</code> files in subdirectories to undo any
573 associations inherited from parent directories or the server
574 config files. An example of its use might be:</p>
576 <div class="example"><h3>/foo/.htaccess:</h3><p><code>
577 AddHandler server-parsed .html
580 <div class="example"><h3>/foo/bar/.htaccess:</h3><p><code>
584 <p>This has the effect of returning <code>.html</code> files in
585 the <code>/foo/bar</code> directory to being treated as normal
586 files, rather than as candidates for parsing (see the <a href="mod_include.html"><code>mod_include</code></a>
589 <p>The <em>extension</em> argument is case-insensitive, and can
590 be specified with or without a leading dot.</p>
591 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveInputFilter" id="RemoveInputFilter">RemoveInputFilter</a> <a name="removeinputfilter" id="removeinputfilter">Directive</a></h2><table class="directive"><tr><th>Description:
592 </th><td>Removes any input filter associations for a set of file
593 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
594 </a></th><td>RemoveInputFilter
595 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
596 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
597 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
598 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
599 </a></th><td>RemoveInputFilter is only available in Apache
600 2.0.26 and later.</td></tr></table>
602 <p>The <code>RemoveInputFilter</code> directive removes any
603 input filter associations for files with the given extensions.
604 This allows <code>.htaccess</code> files in subdirectories to
605 undo any associations inherited from parent directories or the
606 server config files.</p>
608 <p>The <em>extension</em> argument is case-insensitive, and can
609 be specified with or without a leading dot.</p>
611 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveLanguage" id="RemoveLanguage">RemoveLanguage</a> <a name="removelanguage" id="removelanguage">Directive</a></h2><table class="directive"><tr><th>Description:
612 </th><td>Removes any language associations for a set of file
613 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
614 </a></th><td>RemoveLanguage
615 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
616 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
617 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
618 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
619 </a></th><td>RemoveLanguage
620 is only available in Apache 2.0.24 and later.</td></tr></table>
622 <p>The <code>RemoveLanguage</code> directive removes any
623 language associations for files with the given extensions. This
624 allows <code>.htaccess</code> files in subdirectories to undo
625 any associations inherited from parent directories or the
626 server config files.</p>
628 <p>The <em>extension</em> argument is case-insensitive, and can
629 be specified with or without a leading dot.</p>
630 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveOutputFilter" id="RemoveOutputFilter">RemoveOutputFilter</a> <a name="removeoutputfilter" id="removeoutputfilter">Directive</a></h2><table class="directive"><tr><th>Description:
631 </th><td>Removes any output filter associations for a set of file
632 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
633 </a></th><td>RemoveOutputFilter
634 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
635 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
636 </a></th><td /></tr><tr><th><a href="directive-dict.html#Status">Status:
637 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
638 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
639 </a></th><td>RemoveOutputFilter is only available in Apache
640 2.0.26 and later.</td></tr></table>
642 <p>The <code>RemoveOutputFilter</code> directive removes any
643 output filter associations for files with the given extensions.
644 This allows <code>.htaccess</code> files in subdirectories to
645 undo any associations inherited from parent directories or the
646 server config files.</p>
648 <p>The <em>extension</em> argument is case-insensitive, and can
649 be specified with or without a leading dot.</p>
651 <div class="example"><h3>Example</h3><p><code>
652 RemoveOutputFilter shtml
654 <h3>See also</h3><ul><li><code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveType" id="RemoveType">RemoveType</a> <a name="removetype" id="removetype">Directive</a></h2><table class="directive"><tr><th>Description:
655 </th><td>Removes any content type associations for a set of file
656 extensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
657 </a></th><td>RemoveType
658 <em>extension</em> [<em>extension</em>] ...</td></tr><tr><th><a href="directive-dict.html#Context">Context:
659 </a></th><td>virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
660 </a></th><td /></tr><tr><th><a href="directive-dict.html#Status">Status:
661 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
662 </a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:
663 </a></th><td>RemoveType is
664 only available in Apache 1.3.13 and later.</td></tr></table>
665 <p>The <code class="directive">RemoveType</code> directive removes any MIME type
666 associations for files with the given extensions. This allows
667 <code>.htaccess</code> files in subdirectories to undo any
668 associations inherited from parent directories or the server
669 config files. An example of its use might be:</p>
671 <div class="example"><h3>/foo/.htaccess:</h3><p><code>
675 <p>This will remove any special handling of <code>.cgi</code>
676 files in the <code>/foo/</code> directory and any beneath it,
677 causing the files to be treated as being of the <a href="core.html#defaulttype">default type</a>.</p>
679 <div class="note"><strong>Note:</strong><code class="directive">RemoveType</code> directives
680 are processed <em>after</em> any <code class="directive">AddType</code>
681 directives, so it is possible they may undo the effects of the
682 latter if both occur within the same directory
685 <p>The <em>extension</em> argument is case-insensitive, and can
686 be specified with or without a leading dot.</p>
687 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="TypesConfig" id="TypesConfig">TypesConfig</a> <a name="typesconfig" id="typesconfig">Directive</a></h2><table class="directive"><tr><th>Description:
688 </th><td>The location of the mime.types file</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
689 </a></th><td>TypesConfig <em>file-path</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
690 </a></th><td><code>TypesConfig conf/mime.types</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
691 </a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
692 </a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:
693 </a></th><td>mod_mime</td></tr></table>
695 <p>The TypesConfig directive sets the location of the MIME types
696 configuration file. <em>Filename</em> is relative to the <a href="core.html#serverroot">ServerRoot</a>. This file sets the
697 default list of mappings from filename extensions to content
698 types. Most administrators use the provided
699 <code>mime.types</code> file, which associates common filename
700 extensions with IANA registered content types. The current list is
702 <code>http://www.isi.edu/in-notes/iana/assignments/media-types/media-types</code>. This
703 simplifies the <code>httpd.conf</code> file by providing the
704 majority of media-type definitions, and may be overridden by
705 <code class="directive"><a href="#addtype">AddType</a></code> directives as
706 needed. You should not edit the <code>mime.types</code> file,
707 because it may be replaced when you upgrade your server.</p>
709 <p>The file contains lines in the format of the arguments to
710 an <code class="directive"><a href="#addtype">AddType</a></code> directive:</p>
712 <div class="example"><p><code>
713 MIME-type extension extension ...
717 The case of the extension does not matter. Blank lines, and lines
718 beginning with a hash character (`#') are ignored. </p>
720 <div class="note">Please do not send requests to the Apache HTTP Server Project
721 to add any new entries in the distributed mime.types file
722 unless (1) they are already registered with IANA, and (2) they
723 use widely accepted, non-conflicting filename extensions across
724 platforms. category/x-subtype requests will be automatically
725 rejected, as will any new two-letter extensions as they will
726 likely conflict later with the already crowded language and
727 character set namespace.</div>
729 <h3>See also</h3><ul><li><code class="module"><a href="../mod/mod_mime_magic.html">mod_mime_magic</a></code></li></ul></div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</a></p><p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div></body></html>