]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_mime.html
Update the transformations again.
[apache] / docs / manual / mod / mod_mime.html
1 <html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
2 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3      This file is generated from xml source: DO NOT EDIT
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 --><title>mod_mime - Apache HTTP Server</title><link href="../style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img alt="[APACHE DOCUMENTATION]" src="../images/sub.gif"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_mime</h1><table cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td>Associates the request filename's extensions
6     (e.g. .html) with the file's behavior (handlers and filters)
7     and content (mime-type, language, character set and
8     encoding)</td></tr><tr><td><a href="module-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="module-dict.html#ModuleIdentifier" class="help">Module&nbsp;Identifier:</a></td><td>mime_module</td></tr></table></td></tr></table><h2>Summary</h2>
9     <p>This module is used to associate various bits of "meta
10     information" with files by their filename extensions. This
11     information relates the filename of the document to it's
12     mime-type, language, character set and encoding. This
13     information is sent to the browser, and participates in content
14     negotiation, so the user's preferences are respected when
15     choosing one of several possible files to serve. See
16     <code><a href="mod_negotiation.html">mod_negotiation</a></code> for more information
17     about content negotiation. </p>
18
19     <p>The directives <code class="directive">AddCharset</code>,
20     <code class="directive">AddEncoding</code>,
21     <code class="directive">AddLanguage</code> and
22     <code class="directive">AddType</code> all used to map file extensions
23     onto the meta-information for that file. Respectively they set
24     the character set, content-encoding, content-language, and
25     MIME-type (content-type) of documents.</p>
26
27     <p>In addition, mod_mime may define the "handler" for a
28     document, which controls which module or script will serve the
29     document. With the introduction of "filters" in Apache 2.0,
30     mod_mime can also define the filters that the the content
31     should be processed through (e.g. the Includes output filter
32     for server side scripting) and what filters the client request
33     and POST content should be processed through (the input
34     filters.)</p>
35
36     <p>The directives <code class="directive">AddHandler</code>,
37     <code class="directive">AddOutputFilter</code>, and
38     <code class="directive">AddInputFilter</code> control the modules
39     or scripts that serve the document.  The 
40     <code class="directive">MultiviewsMatch</code> directive allows
41     <code class="directive">mod_negotiation</code> to consider these
42     file extensions to included when testing Multiviews matches.</p>
43
44     <p>The directive <code class="directive">TypesConfig</code> is used
45     to specify a file which also maps extensions onto MIME types.
46     Most administrators use the provided mime.types file which
47     associates common filename extensions with IANA registered
48     content types. The current list is maintained at
49     <code>http://www.isi.edu/in-notes/iana/assignments/media-types/media-types</code>
50     although it may be mirrored elsewhere). This simplifies the
51     httpd.conf file by providing the majority of media-type
52     definitions, and they may be overridden by 
53     <code class="directive">AddType</code> directives as needed.</p>
54
55     <blockquote><table><tr><td bgcolor="#e0e5f5">Please do not send requests to the Apache httpd Project
56     to add any new entries in the distributed mime.types file
57     unless (1) they are already registered with IANA, and (2) they
58     use widely accepted, non-conflicting filename extensions across
59     platforms. category/x-subtype requests will be automatically
60     rejected, as will any new two-letter extensions as they will
61     likely conflict later with the already crowded language and
62     character set namespace.</td></tr></table></blockquote>
63
64     <p>The core directives <a href="core.html#forcetype" class="directive"><code class="directive">ForceType</code></a> and
65     <code class="directive">SetHandler</code> are used to
66     associate all the files in a given container (<em>e.g.</em>,
67     &lt;location&gt;, &lt;directory&gt;, or &lt;Files&gt;) with a
68     particular MIME-type or handler. These settings override any
69     filename extension mappings defined in mod_mime.</p>
70
71     <p>Note that changing the type or encoding of a file does not
72     change the value of the <code>Last-Modified</code> header.
73     Thus, previously cached copies may still be used by a client or
74     proxy, with the previous headers. If you change the
75     meta-information (language, content type, character set or
76     encoding) you may need to 'touch' affected files (updating
77     their last modified date) to ensure that all visitors are
78     receive the corrected content headers.</p>
79 <h2>Directives</h2><ul><li><a href="#addcharset">AddCharset</a></li><li><a href="#addencoding">AddEncoding</a></li><li><a href="#addhandler">AddHandler</a></li><li><a href="#addinputfilter">AddInputFilter</a></li><li><a href="#addlanguage">AddLanguage</a></li><li><a href="#addoutputfilter">AddOutputFilter</a></li><li><a href="#addtype">AddType</a></li><li><a href="#defaultlanguage">DefaultLanguage</a></li><li><a href="#multiviewsmatch">MultiviewsMatch</a></li><li><a href="#removecharset">RemoveCharset</a></li><li><a href="#removeencoding">RemoveEncoding</a></li><li><a href="#removehandler">RemoveHandler</a></li><li><a href="#removeinputfilter">RemoveInputFilter</a></li><li><a href="#removelanguage">RemoveLanguage</a></li><li><a href="#removeoutputfilter">RemoveOutputFilter</a></li><li><a href="#removetype">RemoveType</a></li><li><a href="#typesconfig">TypesConfig</a></li></ul><p><strong>See also </strong></p><ul><li>See also: <a href="mod_mime_magic.html#mimemagicfile" class="directive"><code class="directive">MimeMagicFile</code></a></li></ul><h2><a name="multipleext">Files with Multiple Extensions</a></h2>
80
81
82     <p>Files can have more than one extension, and the order of the
83     extensions is <em>normally</em> irrelevant. For example, if the
84     file <code>welcome.html.fr</code> maps onto content type
85     text/html and language French then the file <code>welcome.fr.html</code> 
86     will map onto exactly the same information.  If more than one 
87     extension is given which maps onto the same
88     type of meta-information, then the one to the right will be
89     used. For example, if ".gif" maps to the MIME-type image/gif
90     and ".html" maps to the MIME-type text/html, then the file
91     <code>welcome.gif.html</code> will be associated with the
92     MIME-type "text/html".</p>
93
94     <p>Care should be taken when a file with multiple extensions
95     gets associated with both a MIME-type and a handler. This will
96     usually result in the request being by the module associated
97     with the handler. For example, if the <code>.imap</code>
98     extension is mapped to the handler "imap-file" (from mod_imap)
99     and the <code>.html</code> extension is mapped to the MIME-type
100     "text/html", then the file <code>world.imap.html</code> will be
101     associated with both the "imap-file" handler and "text/html"
102     MIME-type. When it is processed, the "imap-file" handler will
103     be used, and so it will be treated as a mod_imap imagemap
104     file.</p>
105 <h2><a name="contentencoding">Content encoding</a></h2>
106
107     <p>A file of a particular MIME type can additionally be encoded a
108     particular way to simplify transmission over the Internet.
109     While this usually will refer to compression, such as
110     <code>gzip</code>, it can also refer to encryption, such a
111     <code>pgp</code> or to an encoding such as UUencoding, which is
112     designed for transmitting a binary file in an ASCII (text)
113     format.</p>
114
115     <p>The MIME RFC puts it this way:</p>
116
117     <blockquote><table><tr><td bgcolor="#e0e5f5">
118       The Content-Encoding entity-header field is used as a
119       modifier to the media-type. When present, its value indicates
120       what additional content coding has been applied to the
121       resource, and thus what decoding mechanism must be applied in
122       order to obtain the media-type referenced by the Content-Type
123       header field. The Content-Encoding is primarily used to allow
124       a document to be compressed without losing the identity of
125       its underlying media type.
126     </td></tr></table></blockquote>
127
128     <p>By using more than one file extension (see <a href="#multipleext">section above about multiple file
129     extensions</a>), you can indicate that a file is of a
130     particular <em>type</em>, and also has a particular
131     <em>encoding</em>. </p>
132
133     <p>For example, you may have a file which is a Microsoft Word
134     document, which is pkzipped to reduce its size. If the
135     <code>.doc</code> extension is associated with the Microsoft
136     Word file type, and the <code>.zip</code> extension is
137     associated with the pkzip file encoding, then the file
138     <code>Resume.doc.zip</code>would be known to be a pkzip'ed Word
139     document.</p>
140
141     <p>Apache send a <code>Content-encoding</code> header with the
142     resource, in order to tell the client browser about the
143     encoding method.</p>
144
145     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>Content-encoding: pkzip</code></td></tr></table></blockquote>
146
147 <h2>Character sets and languages</h2>
148
149
150
151     <p>In addition to file type and the file encoding,
152     another important piece of information is what language a
153     particular document is in, and in what character set the file
154     should be displayed. For example, the document might be written
155     in the Vietnamese alphabet, or in Cyrillic, and should be
156     displayed as such. This information, also, is transmitted in
157     HTTP headers.</p>
158
159     <p>The character set, language encoding and mime type are all 
160     used in the process of content negotiation (See 
161     <code><a href="mod_negotiation.html">mod_negotiation</a></code>) to determine
162     which document to give to the client, when there are
163     alternative documents in more than one character set, language, 
164     encoding or mime type.  All filename extensions associations
165     created with <code><a href="AddCharset.html">AddCharset</a></code>, <code><a href="AddEncoding.html">AddEncoding</a></code>, 
166     <code><a href="AddLanguage.html">AddLanguage</a></code> and <code><a href="AddType.html">AddType</a></code> directives
167     (and extensions listed in the <code><a href="MimeMagicFile.html">MimeMagicFile</a></code>)
168     participate in this select process.  Filename extensions that
169     are only associated using the <code><a href="AddHandler.html">AddHandler</a></code>,
170     <code><a href="AddInputFilter.html">AddInputFilter</a></code> or <code><a href="AddOutputFilter.html">AddOutputFilter</a></code>
171     directives may be included or excluded from matching by using 
172     the <code class="directive">MultiviewsMatch</code> directive.</p>
173
174 <h3>Charset</h3>
175
176
177     <p>To convey this further information, Apache optionally sends
178     a <code>Content-Language</code> header, to specify the language
179     that the document is in, and can append additional information
180     onto the <code>Content-Type</code> header to indicate the
181     particular character set that should be used to correctly
182     render the information.</p>
183
184 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
185 Content-Language: en, fr<br>
186 Content-Type: text/plain; charset=ISO-8859-2
187 </code></td></tr></table></blockquote>
188
189     <p>The language specification is the two-letter abbreviation
190     for the language. The <code>charset</code> is the name of the
191     particular character set which should be used.</p>
192
193 <hr/><h2><a name="AddCharset">AddCharset</a> <a name="addcharset">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Maps the given filename extensions
194     to the specified content charset</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddCharset <em>charset extension</em> 
195 [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>AddCharset is only available in Apache 
196 1.3.10 and later</td></tr></table></td></tr></table>
197     
198     <p>The AddCharset directive maps the given filename extensions
199     to the specified content charset. <em>charset</em> is the MIME
200     charset parameter of filenames containing <em>extension</em>.
201     This mapping is added to any already in force, overriding any
202     mappings that already exist for the same <em>extension</em>.</p>
203
204     <p>Example:</p>
205 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
206     AddLanguage ja .ja<br>
207     AddCharset EUC-JP .euc<br>
208     AddCharset ISO-2022-JP .jis<br>
209     AddCharset SHIFT_JIS .sjis
210 </code></td></tr></table></blockquote>
211
212     <p>Then the document <code>xxxx.ja.jis</code> will be treated
213     as being a Japanese document whose charset is ISO-2022-JP (as
214     will the document <code>xxxx.jis.ja</code>). The AddCharset
215     directive is useful for both to inform the client about the
216     character encoding of the document so that the document can be
217     interpreted and displayed appropriately, and for <a href="../content-negotiation.html">content negotiation</a>,
218     where the server returns one from several documents based on
219     the client's charset preference.</p>
220
221     <p>The <em>extension</em> argument is case-insensitive, and can
222     be specified with or without a leading dot.</p>
223
224 <p><strong>See also </strong></p><ul><li><code><a href="mod_negotiation.html">mod_negotiation</a></code></li></ul><hr/><h2><a name="AddEncoding">AddEncoding</a> <a name="addencoding">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Maps the given filename extensions
225     to the specified encoding type</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddEncoding
226     <em>MIME-enc extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr></table></td></tr></table>
227
228     <p>The AddEncoding directive maps the given filename extensions
229     to the specified encoding type. <em>MIME-enc</em> is the MIME
230     encoding to use for documents containing the
231     <em>extension</em>. This mapping is added to any already in
232     force, overriding any mappings that already exist for the same
233     <em>extension</em>. Example:</p>
234
235     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
236       AddEncoding x-gzip .gz<br>
237       AddEncoding x-compress .Z
238     </code></td></tr></table></blockquote>
239
240     <p>This will cause filenames containing the .gz extension to be
241     marked as encoded using the x-gzip encoding, and filenames
242     containing the .Z extension to be marked as encoded with
243     x-compress. </p>
244
245     <p>Old clients expect <code>x-gzip</code> and
246     <code>x-compress</code>, however the standard dictates that
247     they're equivalent to <code>gzip</code> and
248     <code>compress</code> respectively. Apache does content
249     encoding comparisons by ignoring any leading <code>x-</code>.
250     When responding with an encoding Apache will use whatever form
251     (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the
252     client requested. If the client didn't specifically request a
253     particular form Apache will use the form given by the
254     <code>AddEncoding</code> directive. To make this long story
255     short, you should always use <code>x-gzip</code> and
256     <code>x-compress</code> for these two specific encodings. More
257     recent encodings, such as <code>deflate</code> should be
258     specified without the <code>x-</code>.</p>
259
260     <p>The <em>extension</em> argument is case-insensitive, and can
261     be specified with or without a leading dot.</p>
262
263 <p><strong>See also </strong></p><ul><li><a href="#multipleext">Files with
264     multiple extensions</a></li></ul><hr/><h2><a name="AddHandler">AddHandler</a> <a name="addhandler">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>AddHandler maps the filename extensions
265 to the handler 
266 handler-name</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddHandler
267     <em>handler-name extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td/></tr></table></td></tr></table>
268 <p>This mapping is added to any already in
269     force, overriding any mappings that already exist for the same
270     <em>extension</em>. For example, to activate CGI scripts with
271     the file extension "<code>.cgi</code>", you might use:</p>
272
273 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
274     AddHandler cgi-script .cgi
275 </code></td></tr></table></blockquote>
276
277     <p>Once that has been put into your srm.conf or httpd.conf
278     file, any file containing the "<code>.cgi</code>" extension
279     will be treated as a CGI program.</p>
280
281     <p>The <em>extension</em> argument is case-insensitive, and can
282     be specified with or without a leading dot.</p>
283
284 <p><strong>See also </strong></p><ul><li><a href="#multipleext">Files with
285     multiple extensions</a></li></ul><hr/><h2><a name="AddInputFilter">AddInputFilter</a> <a name="addinputfilter">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Maps the filename extensions
286     to the filter or filters which will process
287     client requests</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddInputFilter
288     <em>filter</em>[<em>;filter</em>...] extension
289     [<em>extension</em> ...]</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>AddInputFilter
290     is only available in Apache 2.0.26 and later.</td></tr></table></td></tr></table>
291
292     <p>AddInputFilter maps the filename extensions
293     <em>extension</em> to the filter or filters which will process
294     client requests and POST input when they are received by the
295     server. This is in addition to any filters defined elsewhere,
296     including the <a href="core.html#setinputfilter">SetInputFilter</a> directive.
297     This mapping is merged over any already in force, overriding
298     any mappings that already exist for the same
299     <em>extension</em>.</p>
300
301     <p>If more than one filter is specified, they must be separated
302     by semicolons in the order in which they should process the
303     content. Both the filter and <em>extension</em> arguments are
304     case-insensitive, and the extension may be specified with or
305     without a leading dot.</p>
306
307 <p><strong>See also </strong></p><ul><li><a href="../filter.html">Filters</a>
308     documentation.</li></ul><hr/><h2><a name="AddLanguage">AddLanguage</a> <a name="addlanguage">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Maps the given filename extension
309 to the specified content language</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddLanguage
310     <em>MIME-lang extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr></table></td></tr></table>
311
312     <p>The AddLanguage directive maps the given filename extension
313     to the specified content language. <em>MIME-lang</em> is the
314     MIME language of filenames containing <em>extension</em>. This
315     mapping is added to any already in force, overriding any
316     mappings that already exist for the same
317     <em>extension</em>.</p>
318
319     <p>Example:</p>
320
321     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
322       AddEncoding x-compress .Z<br>
323        AddLanguage en .en<br>
324        AddLanguage fr .fr
325     </code></td></tr></table></blockquote>
326
327     <p>Then the document <code>xxxx.en.Z</code> will be treated as
328     being a compressed English document (as will the document
329     <code>xxxx.Z.en</code>). Although the content language is
330     reported to the client, the browser is unlikely to use this
331     information. The AddLanguage directive is more useful for <a href="../content-negotiation.html">content negotiation</a>,
332     where the server returns one from several documents based on
333     the client's language preference.</p>
334
335     <p>If multiple language assignments are made for the same
336     extension, the last one encountered is the one that is used.
337     That is, for the case of:</p>
338
339 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
340     AddLanguage en .en<br>
341     AddLanguage en-uk .en<br>
342     AddLanguage en-us .en
343 </code></td></tr></table></blockquote>
344
345     <p>documents with the extension "<code>.en</code>" would be
346     treated as being "<code>en-us</code>".</p>
347
348     <p>The <em>extension</em> argument is case-insensitive, and can
349     be specified with or without a leading dot.</p>
350
351 <p><strong>See also </strong></p><ul><li><a href="#multipleext">Files with
352     multiple extensions</a></li><li><code><a href="mod_negotiation.html">mod_negotiation</a></code></li></ul><hr/><h2><a name="AddOutputFilter">AddOutputFilter</a> <a name="addoutputfilter">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>maps the filename
353 extensions to the filters that will process
354 responses from the server</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddOutputFilter
355     <em>filter</em>[<em>;filter</em>...] extension
356     [<em>extension</em> ...]</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td/></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>AddOutputFilter
357     is only available in Apache 2.0.26 and later.</td></tr></table></td></tr></table>
358
359     <p>The <code class="directive">AddOutputFilter</code> directive maps the filename
360     extensions <em>extension</em> to the filters which will process
361     responses from the server before they are sent to the client.
362     This is in addition to any filters defined elsewhere, including
363     the <a href="core.html#setoutputfilter" class="directive"><code class="directive">SetOutputFilter</code></a>
364     directive. This mapping is merged over any already in force,
365     overriding any mappings that already exist for the same
366     <em>extension</em>.</p>
367
368     <p>For example, the following configuration will process all
369     .shtml files for server-side includes.</p>
370      
371
372     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
373       &nbsp;&nbsp;AddOutputFilter INCLUDES shtml
374     </code></td></tr></table></blockquote>
375
376     <p>If more than one filter is specified, they must be separated
377     by semicolons in the order in which they should process the
378     content. Both the filter and <em>extension</em> arguments are
379     case-insensitive, and the extension may be specified with or
380     without a leading dot.</p>
381
382 <p><strong>See also </strong></p><ul><li><a href="../filter.html">Filters</a> documentation</li></ul><hr/><h2><a name="AddType">AddType</a> <a name="addtype">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Maps the given filename extensions
383 onto the specified content type</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>AddType <em>MIME-type
384     extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr></table></td></tr></table>
385
386     <p>The AddType directive maps the given filename extensions
387     onto the specified content type. <em>MIME-type</em> is the MIME
388     type to use for filenames containing <em>extension</em>. This
389     mapping is added to any already in force, overriding any
390     mappings that already exist for the same <em>extension</em>.
391     This directive can be used to add mappings not listed in the
392     MIME types file (see the <code class="directive">TypesConfig</code>
393     directive).</p>
394     
395     <p>Example:</p>
396
397     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
398       AddType image/gif .gif
399     </code></td></tr></table></blockquote>
400
401     <blockquote><table><tr><td bgcolor="#e0e5f5">It is recommended that new MIME types be added using the
402     AddType directive rather than changing the 
403     <code class="directive">TypesConfig</code> file. </td></tr></table></blockquote>
404
405     <blockquote><table><tr><td bgcolor="#e0e5f5">Note that, unlike the NCSA httpd, this directive cannot be
406     used to set the type of particular files.</td></tr></table></blockquote>
407
408     <p>The <em>extension</em> argument is case-insensitive, and can
409     be specified with or without a leading dot.</p>
410
411 <p><strong>See also </strong></p><ul><li><a href="#multipleext">Files with
412     multiple extensions</a></li></ul><hr/><h2><a name="DefaultLanguage">DefaultLanguage</a> <a name="defaultlanguage">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Sets all files in the given scope to the 
413 specified language</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>DefaultLanguage
414     <em>MIME-lang</em></td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>DefaultLanguage
415     is only available in Apache 1.3.4 and later.</td></tr></table></td></tr></table>
416
417     <p>The DefaultLanguage directive tells Apache that all files in
418     the directive's scope (<em>e.g.</em>, all files covered by the
419     current <code>&lt;Directory&gt;</code> container) that don't
420     have an explicit language extension (such as <code>.fr</code>
421     or <code>.de</code> as configured by <code>AddLanguage</code>)
422     should be considered to be in the specified <em>MIME-lang</em>
423     language. This allows entire directories to be marked as
424     containing Dutch content, for instance, without having to
425     rename each file. Note that unlike using extensions to specify
426     languages, <code>DefaultLanguage</code> can only specify a
427     single language.</p>
428
429     <p>If no <code>DefaultLanguage</code> directive is in force,
430     and a file does not have any language extensions as configured
431     by <code>AddLanguage</code>, then that file will be considered
432     to have no language attribute.</p>
433
434 <p><strong>See also </strong></p><ul><li><a href="#multipleext">Files with
435     multiple extensions</a></li><li><code><a href="mod_negotiation.html">mod_negotiation</a></code></li></ul><hr/><h2><a name="MultiviewsMatch">MultiviewsMatch</a> <a name="multiviewsmatch">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>MultiviewsMatch
436     <em>[NegotiatedOnly] [Handlers] [Filters] [Any]</em></td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config, virtual host, directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td>FileInfo</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>only available 
437     in Apache 2.0.26 and later.</td></tr></table></td></tr></table>
438
439     <p>MultiviewsMatch permits three different behaviors for
440     <a href="mod_negotiation.html">mod_negotiation</a>'s Multiviews 
441     feature.  Multiviews allows a request for a file, e.g. index.html,
442     to match any negotiated extensions following the base request,
443     e.g. index.html.en, index.html,fr, or index.html.gz.</p>
444
445     <p>The NegotiatedOnly option provides that every extension following
446     the base name must correlate to a recognized mod_mime extension for
447     content negotation, e.g. Charset, Content-Type, Language, or 
448     Encoding.  This is the strictest implementation with the fewest
449     unexpected side effects, and is the default behavior.</p>
450
451     <p>To include extensions associated with Handlers and/or Filters,
452     set the MultiviewsMatch directive to either Handlers, Filters, or
453     both option keywords.  If all other factors are equal, the smallest
454     file will be served, e.g. in deciding between index.html.cgi of 500
455     characters and index.html.pl of 1000 bytes, the .cgi file would win
456     in this example.  Users of .asis files might prefer to use the
457     Handler option, if .asis files are associated with the asis-handler.</p>
458
459     <p>You may finally allow Any extensions to match, even if mod_mime 
460     doesn't recognize the extension.  This was the behavior in Apache 1.3,
461     and can cause unpredicatable results, such as serving .old or .bak
462     files the webmaster never expected to be served.</p>
463 <hr/><h2><a name="RemoveCharset">RemoveCharset</a> <a name="removecharset">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveCharset
464     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveCharset is
465     only available in Apache 2.0.24 and later.</td></tr></table></td></tr></table>
466     <p>The <code>RemoveCharset</code> directive removes any
467     character set associations for files with the given extensions.
468     This allows <code>.htaccess</code> files in subdirectories to
469     undo any associations inherited from parent directories or the
470     server config files.</p>
471
472     <p>The <em>extension</em> argument is case-insensitive, and can
473     be specified with or without a leading dot.</p>
474 <hr/><h2><a name="RemoveEncoding">RemoveEncoding</a> <a name="removeencoding">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveEncoding
475     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveEncoding
476     is only available in Apache 1.3.13 and later.</td></tr></table></td></tr></table>
477
478     <p>The <code>RemoveEncoding</code> directive removes any
479     encoding associations for files with the given extensions. This
480     allows <code>.htaccess</code> files in subdirectories to undo
481     any associations inherited from parent directories or the
482     server config files. An example of its use might be:</p>
483
484
485 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
486     <dl>
487       <dt><code>/foo/.htaccess:</code></dt>
488       <dd><code>AddEncoding x-gzip .gz</code><br>
489        <code>AddType text/plain .asc</code><br>
490        <code>&lt;Files *.gz.asc&gt;</code><br>
491        <code>&nbsp;&nbsp;&nbsp;&nbsp;RemoveEncoding
492       .gz</code><br>
493        <code>&lt;/Files&gt;</code></dd>
494     </dl>
495 </code></td></tr></table></blockquote>
496
497     <p>This will cause <code>foo.gz</code> to be marked as being
498     encoded with the gzip method, but <code>foo.gz.asc</code> as an
499     unencoded plaintext file.</p>
500
501     <p><strong>Note:</strong>RemoveEncoding directives are processed
502     <em>after</em> any AddEncoding directives, so it is possible they
503     may undo the effects of the latter if both occur within the
504     same directory configuration.</p>
505
506     <p>The <em>extension</em> argument is case-insensitive, and can
507     be specified with or without a leading dot.</p>
508 <hr/><h2><a name="RemoveHandler">RemoveHandler</a> <a name="removehandler">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveHandler
509     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveHandler is
510     only available in Apache 1.3.4 and later.</td></tr></table></td></tr></table>
511
512     <p>The <code>RemoveHandler</code> directive removes any handler
513     associations for files with the given extensions. This allows
514     <code>.htaccess</code> files in subdirectories to undo any
515     associations inherited from parent directories or the server
516     config files. An example of its use might be:</p>
517
518 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
519     <dl>
520       <dt><code>/foo/.htaccess:</code></dt>
521
522       <dd><code>AddHandler server-parsed .html</code></dd>
523
524       <dt><code>/foo/bar/.htaccess:</code></dt>
525
526       <dd><code>RemoveHandler .html</code></dd>
527     </dl>
528 </code></td></tr></table></blockquote>
529
530     <p>This has the effect of returning <code>.html</code> files in
531     the <code>/foo/bar</code> directory to being treated as normal
532     files, rather than as candidates for parsing (see the <a href="mod_include.html"><code>mod_include</code></a>
533     module).</p>
534
535     <p>The <em>extension</em> argument is case-insensitive, and can
536     be specified with or without a leading dot.</p>
537 <hr/><h2><a name="RemoveInputFilter">RemoveInputFilter</a> <a name="removeinputfilter">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveInputFilter
538     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveInputFilter is only available in Apache 
539 2.0.26 and later.</td></tr></table></td></tr></table>   
540
541     <p>The <code>RemoveInputFilter</code> directive removes any
542     input filter associations for files with the given extensions.
543     This allows <code>.htaccess</code> files in subdirectories to
544     undo any associations inherited from parent directories or the
545     server config files.</p>
546
547     <p>The <em>extension</em> argument is case-insensitive, and can
548     be specified with or without a leading dot.</p>
549 <hr/><h2><a name="RemoveLanguage">RemoveLanguage</a> <a name="removelanguage">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveLanguage
550     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>None</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveLanguage
551     is only available in Apache 2.0.24 and later.</td></tr></table></td></tr></table>
552
553     <p>The <code>RemoveLanguage</code> directive removes any
554     language associations for files with the given extensions. This
555     allows <code>.htaccess</code> files in subdirectories to undo
556     any associations inherited from parent directories or the
557     server config files.</p>
558
559     <p>The <em>extension</em> argument is case-insensitive, and can
560     be specified with or without a leading dot.</p>
561 <hr/><h2><a name="RemoveOutputFilter">RemoveOutputFilter</a> <a name="removeoutputfilter">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveOutputFilter
562     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code/></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td/></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveOutputFilter is only available in Apache 
563 2.0.26 and later.</td></tr></table></td></tr></table>    
564
565     <p>The <code>RemoveOutputFilter</code> directive removes any
566     output filter associations for files with the given extensions.
567     This allows <code>.htaccess</code> files in subdirectories to
568     undo any associations inherited from parent directories or the
569     server config files.</p>
570
571     <p>The <em>extension</em> argument is case-insensitive, and can
572     be specified with or without a leading dot.</p>
573 <hr/><h2><a name="RemoveType">RemoveType</a> <a name="removetype">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>RemoveType
574     <em>extension</em> [<em>extension</em>] ...</td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code/></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>directory, .htaccess</td></tr><tr><td><a href="directive-dict.html#Override" class="help">Override:</a></td><td/></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr><tr><td align="left" valign="top"><a href="directive-dict.html#Compatibility" class="help">Compatibility:</a></td><td>RemoveType is
575     only available in Apache 1.3.13 and later.</td></tr></table></td></tr></table>
576     <p>The <code class="directive">RemoveType</code> directive removes any MIME type
577     associations for files with the given extensions. This allows
578     <code>.htaccess</code> files in subdirectories to undo any
579     associations inherited from parent directories or the server
580     config files. An example of its use might be:</p>
581
582 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
583     <dl>
584       <dt><code>/foo/.htaccess:</code></dt>
585
586       <dd><code>RemoveType .cgi</code></dd>
587     </dl>
588 </code></td></tr></table></blockquote>
589
590     <p>This will remove any special handling of <code>.cgi</code>
591     files in the <code>/foo/</code> directory and any beneath it,
592     causing the files to be treated as being of the <a href="core.html#defaulttype">default type</a>.</p>
593
594     <blockquote><table><tr><td bgcolor="#e0e5f5"><strong>Note:</strong><code><a href="RemoveType.html">RemoveType</a></code> directives
595     are processed <em>after</em> any <code><a href="AddType.html">AddType</a></code>
596     directives, so it is possible they may undo the effects of the
597     latter if both occur within the same directory
598     configuration.</td></tr></table></blockquote>
599
600     <p>The <em>extension</em> argument is case-insensitive, and can
601     be specified with or without a leading dot.</p>
602 <hr/><h2><a name="TypesConfig">TypesConfig</a> <a name="typesconfig">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td/></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>TypesConfig <em>file-path</em></td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>TypesConfig conf/mime.types</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_mime</td></tr></table></td></tr></table>
603
604     <p>The TypesConfig directive sets the location of the MIME
605     types configuration file. <em>Filename</em> is relative to the
606     <a href="core.html#serverroot">ServerRoot</a>. This file sets
607     the default list of mappings from filename extensions to
608     content types; changing this file is not recommended. Use the
609     <a href="#addtype">AddType</a> directive instead. The file
610     contains lines in the format of the arguments to an AddType
611     command:</p>
612
613     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
614       MIME-type extension extension ...
615     </code></td></tr></table></blockquote>
616
617     <p>
618     The extensions are lower-cased. Blank lines, and lines
619     beginning with a hash character (`#') are ignored. </p>
620 <hr/><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img alt="Index" src="../images/index.gif"/></a><a href="../"><img alt="Home" src="../images/home.gif"/></a></blockquote></body></html>