]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_mime.html.en
Documentation rebuild after recent commits
[apache] / docs / manual / mod / mod_mime.html.en
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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mod_mime - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_mime</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../en/mod/mod_mime.html" title="English">&nbsp;en&nbsp;</a> |
30 <a href="../ja/mod/mod_mime.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
31 </div>
32 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Associates the requested filename's extensions
33     with the file's behavior (handlers and filters)
34     and content (mime-type, language, character set and
35     encoding)</td></tr>
36 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
37 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>mime_module</td></tr>
38 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_mime.c</td></tr></table>
39 <h3>Summary</h3>
40
41     <p>This module is used to assign content metadata to the content
42     selected for an HTTP response by mapping patterns in the
43     URI or filenames to the metadata values.  For example, the filename
44     extensions of content files often define the content's Internet
45     media type, language, character set, and content-encoding. This
46     information is sent in HTTP messages containing that content and
47     used in content negotiation when selecting alternatives, such that
48     the user's preferences are respected when choosing one of several
49     possible contents to serve. See
50     <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code> for more information
51     about <a href="../content-negotiation.html">content negotiation</a>.</p>
52
53     <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
54     extensions onto the metadata for that file. Respectively
55     they set the character set, content-encoding, content-language,
56     and <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a> (content-type) of documents.  The directive <code class="directive"><a href="#typesconfig">TypesConfig</a></code> is used to specify a
57     file which also maps extensions onto media types. </p>
58
59     <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
60     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
61     or scripts that serve the document.  The <code class="directive"><a href="#multiviewsmatch">MultiviewsMatch</a></code> directive allows
62     <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code> to consider these file extensions
63     to be included when testing Multiviews matches.</p>
64
65     <p>While <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> associates metadata
66     with filename extensions, the <code class="module"><a href="../mod/core.html">core</a></code> server
67     provides directives that are used to associate all the files in a
68     given container (<em>e.g.</em>, <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code>, <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code>, or <code class="directive"><a href="../mod/core.html#files">&lt;Files&gt;</a></code>) with particular
69     metadata. 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
70     override any filename extension mappings defined in
71     <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code>.</p>
72
73     <p>Note that changing the metadata for a file does not
74     change the value of the <code>Last-Modified</code> header.
75     Thus, previously cached copies may still be used by a client or
76     proxy, with the previous headers. If you change the
77     metadata (language, content type, character set or
78     encoding) you may need to 'touch' affected files (updating
79     their last modified date) to ensure that all visitors are
80     receive the corrected content headers.</p>
81 </div>
82 <div id="quickview"><h3>Topics</h3>
83 <ul id="topics">
84 <li><img alt="" src="../images/down.gif" /> <a href="#multipleext">Files with Multiple Extensions</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#contentencoding">Content encoding</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#charset-lang">Character sets and languages</a></li>
87 </ul><h3 class="directives">Directives</h3>
88 <ul id="toc">
89 <li><img alt="" src="../images/down.gif" /> <a href="#addcharset">AddCharset</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#addencoding">AddEncoding</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#addhandler">AddHandler</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#addinputfilter">AddInputFilter</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#addlanguage">AddLanguage</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilter">AddOutputFilter</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#addtype">AddType</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#defaultlanguage">DefaultLanguage</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#modmimeusepathinfo">ModMimeUsePathInfo</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#multiviewsmatch">MultiviewsMatch</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#removecharset">RemoveCharset</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#removeencoding">RemoveEncoding</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#removehandler">RemoveHandler</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#removeinputfilter">RemoveInputFilter</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#removelanguage">RemoveLanguage</a></li>
104 <li><img alt="" src="../images/down.gif" /> <a href="#removeoutputfilter">RemoveOutputFilter</a></li>
105 <li><img alt="" src="../images/down.gif" /> <a href="#removetype">RemoveType</a></li>
106 <li><img alt="" src="../images/down.gif" /> <a href="#typesconfig">TypesConfig</a></li>
107 </ul>
108 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_mime">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_mime">Report a bug</a></li></ul><h3>See also</h3>
109 <ul class="seealso">
110 <li><code class="directive"><a href="../mod/mod_mime_magic.html#mimemagicfile">MimeMagicFile</a></code></li>
111 <li><code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code></li>
112 <li><code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code></li>
113 <li><code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code></li>
114 <li><code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code></li>
115 <li><code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code></li>
116 <li><a href="#comments_section">Comments</a></li></ul></div>
117 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
118 <div class="section">
119 <h2><a name="multipleext" id="multipleext">Files with Multiple Extensions</a></h2>
120     <p>Files can have more than one extension; the order of the
121     extensions is <em>normally</em> irrelevant. For example, if the
122     file <code>welcome.html.fr</code> maps onto content type
123     <code>text/html</code> and language French then the file
124     <code>welcome.fr.html</code> will map onto exactly the same
125     information.  If more than one extension is given that maps onto
126     the same type of metadata, then the one to the right will
127     be used, except for languages and content encodings. For example,
128     if <code>.gif</code> maps to the <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a>
129     <code>image/gif</code> and <code>.html</code> maps to the
130     media-type <code>text/html</code>, then the file
131     <code>welcome.gif.html</code> will be associated with the
132     media-type <code>text/html</code>.</p>
133
134     <p><a href="#charset-lang">Languages</a> and <a href="#contentencoding">content encodings</a> are treated accumulative, because one can assign
135     more than one language or encoding to a particular resource. For example,
136     the file <code>welcome.html.en.de</code> will be delivered with
137     <code>Content-Language: en, de</code> and <code>Content-Type:
138     text/html</code>.</p>
139
140     <p>Care should be taken when a file with multiple extensions
141     gets associated with both a <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a>
142     and a handler. This will
143     usually result in the request being handled by the module associated
144     with the handler. For example, if the <code>.imap</code>
145     extension is mapped to the handler <code>imap-file</code> (from
146     <code class="module"><a href="../mod/mod_imagemap.html">mod_imagemap</a></code>) and the <code>.html</code> extension is
147     mapped to the media-type <code>text/html</code>, then the file
148     <code>world.imap.html</code> will be associated with both the
149     <code>imap-file</code> handler and <code>text/html</code> media-type.
150     When it is processed, the <code>imap-file</code> handler will be used,
151     and so it will be treated as a <code class="module"><a href="../mod/mod_imagemap.html">mod_imagemap</a></code> imagemap
152     file.</p>
153
154     <p>If you would prefer only the last dot-separated part of the
155     filename to be mapped to a particular piece of meta-data, then do
156     not use the <code>Add*</code> directives. For example, if you wish
157     to have the file <code>foo.html.cgi</code> processed as a CGI
158     script, but not the file <code>bar.cgi.html</code>, then instead
159     of using <code>AddHandler cgi-script .cgi</code>, use</p>
160
161     <div class="example"><h3>Configure handler based on final extension only</h3><pre class="prettyprint lang-config">&lt;FilesMatch "[^.]+\.cgi$"&gt;
162   SetHandler cgi-script
163 &lt;/FilesMatch&gt;</pre>
164 </div>
165
166 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
167 <div class="section">
168 <h2><a name="contentencoding" id="contentencoding">Content encoding</a></h2>
169     <p>A file of a particular <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a> can additionally be encoded a
170     particular way to simplify transmission over the Internet.
171     While this usually will refer to compression, such as
172     <code>gzip</code>, it can also refer to encryption, such a
173     <code>pgp</code> or to an encoding such as UUencoding, which is
174     designed for transmitting a binary file in an ASCII (text)
175     format.</p>
176
177     <p>The <a href="http://www.ietf.org/rfc/rfc2616.txt">HTTP/1.1
178     RFC</a>, section 14.11 puts it this way:</p>
179
180     <blockquote cite="http://www.ietf.org/rfc/rfc2616.txt">
181       <p>The Content-Encoding entity-header field is used as a modifier to
182       the media-type. When present, its value indicates what additional
183       content codings have been applied to the entity-body, and thus what
184       decoding mechanisms must be applied in order to obtain the media-type
185       referenced by the Content-Type header field. Content-Encoding is
186       primarily used to allow a document to be compressed without losing
187       the identity of its underlying media type.</p>
188     </blockquote>
189
190     <p>By using more than one file extension (see <a href="#multipleext">section above about multiple file
191     extensions</a>), you can indicate that a file is of a
192     particular <em>type</em>, and also has a particular
193     <em>encoding</em>. </p>
194
195     <p>For example, you may have a file which is a Microsoft Word
196     document, which is pkzipped to reduce its size. If the
197     <code>.doc</code> extension is associated with the Microsoft
198     Word file type, and the <code>.zip</code> extension is
199     associated with the pkzip file encoding, then the file
200     <code>Resume.doc.zip</code> would be known to be a pkzip'ed Word
201     document.</p>
202
203     <p>Apache sends a <code>Content-encoding</code> header with the
204     resource, in order to tell the client browser about the
205     encoding method.</p>
206
207     <pre class="prettyprint lang-config">Content-encoding: pkzip</pre>
208
209 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
210 <div class="section">
211 <h2><a name="charset-lang" id="charset-lang">Character sets and languages</a></h2>
212     <p>In addition to file type and the file encoding,
213     another important piece of information is what language a
214     particular document is in, and in what character set the file
215     should be displayed. For example, the document might be written
216     in the Vietnamese alphabet, or in Cyrillic, and should be
217     displayed as such. This information, also, is transmitted in
218     HTTP headers.</p>
219
220     <p>The character set, language, encoding and mime type are all
221     used in the process of content negotiation (See
222     <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>) to determine
223     which document to give to the client, when there are
224     alternative documents in more than one character set, language,
225     encoding or mime type. All filename extensions associations
226     created with <code class="directive"><a href="#addcharset">AddCharset</a></code>,
227     <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> directives
228     (and extensions listed in the <code class="directive"><a href="../mod/mod_mime_magic.html#mimemagicfile">MimeMagicFile</a></code>) participate in this select process.
229     Filename extensions that are only associated using the <code class="directive"><a href="#addhandler">AddHandler</a></code>, <code class="directive"><a href="#addinputfilter">AddInputFilter</a></code> or <code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code> directives may be included or excluded
230     from matching by using the <code class="directive"><a href="#multiviewsmatch">MultiviewsMatch</a></code> directive.</p>
231
232     <h3><a name="charset" id="charset">Charset</a></h3>
233       <p>To convey this further information, Apache optionally sends
234       a <code>Content-Language</code> header, to specify the language
235       that the document is in, and can append additional information
236       onto the <code>Content-Type</code> header to indicate the
237       particular character set that should be used to correctly
238       render the information.</p>
239
240       <div class="example"><p><code>
241 Content-Language: en, fr
242 Content-Type: text/plain; charset=ISO-8859-1
243       </code></p></div>
244
245       <p>The language specification is the two-letter abbreviation
246       for the language. The <code>charset</code> is the name of the
247       particular character set which should be used.</p>
248     
249 </div>
250 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
251 <div class="directive-section"><h2><a name="AddCharset" id="AddCharset">AddCharset</a> <a name="addcharset" id="addcharset">Directive</a></h2>
252 <table class="directive">
253 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extensions to the specified content
254 charset</td></tr>
255 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddCharset <var>charset</var> <var>extension</var>
256 [<var>extension</var>] ...</code></td></tr>
257 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
258 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
259 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
260 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
261 </table>
262     <p>The <code class="directive">AddCharset</code> directive maps the given
263     filename extensions to the specified content charset (the Internet
264     registered name for a given character encoding). <var>charset</var>
265     is the <a href="http://www.iana.org/assignments/character-sets">media
266     type's charset parameter</a> for resources with filenames containing
267     <var>extension</var>. This mapping is added to any already in force,
268     overriding any mappings that already exist for the same
269     <var>extension</var>.</p>
270
271     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">AddLanguage ja .ja
272 AddCharset EUC-JP .euc
273 AddCharset ISO-2022-JP .jis
274 AddCharset SHIFT_JIS .sjis</pre>
275 </div>
276
277     <p>Then the document <code>xxxx.ja.jis</code> will be treated
278     as being a Japanese document whose charset is <code>ISO-2022-JP</code>
279     (as will the document <code>xxxx.jis.ja</code>). The
280     <code class="directive">AddCharset</code> directive is useful for both to
281     inform the client about the character encoding of the document so that
282     the document can be interpreted and displayed appropriately, and for <a href="../content-negotiation.html">content negotiation</a>,
283     where the server returns one from several documents based on
284     the client's charset preference.</p>
285
286     <p>The <var>extension</var> argument is case-insensitive and can
287     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
288     <var>extension</var> argument will be compared against each of
289     them.</p>
290
291
292 <h3>See also</h3>
293 <ul>
294 <li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li>
295 <li><code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code></li>
296 </ul>
297 </div>
298 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
299 <div class="directive-section"><h2><a name="AddEncoding" id="AddEncoding">AddEncoding</a> <a name="addencoding" id="addencoding">Directive</a></h2>
300 <table class="directive">
301 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extensions to the specified encoding
302 type</td></tr>
303 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddEncoding <var>encoding</var> <var>extension</var>
304 [<var>extension</var>] ...</code></td></tr>
305 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
306 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
307 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
308 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
309 </table>
310     <p>The <code class="directive">AddEncoding</code> directive maps the given
311     filename extensions to the specified HTTP content-encoding.
312     <var>encoding</var> is the HTTP content coding to append to the
313     value of the Content-Encoding header field for documents named with the
314     <var>extension</var>. This mapping is added to any already in force,
315     overriding any mappings that already exist for the same
316     <var>extension</var>.</p>
317
318     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">AddEncoding x-gzip .gz
319 AddEncoding x-compress .Z</pre>
320 </div>
321
322     <p>This will cause filenames containing the <code>.gz</code> extension
323     to be marked as encoded using the <code>x-gzip</code> encoding, and
324     filenames containing the <code>.Z</code> extension to be marked as
325     encoded with <code>x-compress</code>.</p>
326
327     <p>Old clients expect <code>x-gzip</code> and <code>x-compress</code>,
328     however the standard dictates that they're equivalent to
329     <code>gzip</code> and <code>compress</code> respectively. Apache does
330     content encoding comparisons by ignoring any leading <code>x-</code>.
331     When responding with an encoding Apache will use whatever form
332     (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the
333     client requested. If the client didn't specifically request a
334     particular form Apache will use the form given by the
335     <code>AddEncoding</code> directive. To make this long story
336     short, you should always use <code>x-gzip</code> and
337     <code>x-compress</code> for these two specific encodings. More
338     recent encodings, such as <code>deflate</code>, should be
339     specified without the <code>x-</code>.</p>
340
341     <p>The <var>extension</var> argument is case-insensitive and can
342     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
343     <var>extension</var> argument will be compared against each of
344     them.</p>
345
346 </div>
347 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
348 <div class="directive-section"><h2><a name="AddHandler" id="AddHandler">AddHandler</a> <a name="addhandler" id="addhandler">Directive</a></h2>
349 <table class="directive">
350 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the filename extensions to the specified
351 handler</td></tr>
352 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddHandler <var>handler-name</var> <var>extension</var>
353 [<var>extension</var>] ...</code></td></tr>
354 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
355 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
356 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
357 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
358 </table>
359     <p>Files having the name <var>extension</var> will be served by the
360     specified <var><a href="../handler.html">handler-name</a></var>. This
361     mapping is added to any already in force, overriding any mappings that
362     already exist for the same <var>extension</var>. For example, to
363     activate CGI scripts with the file extension <code>.cgi</code>, you
364     might use:</p>
365
366     <pre class="prettyprint lang-config">AddHandler cgi-script .cgi</pre>
367
368
369     <p>Once that has been put into your httpd.conf file, any file containing
370     the <code>.cgi</code> extension will be treated as a CGI program.</p>
371
372     <p>The <var>extension</var> argument is case-insensitive and can
373     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
374     <var>extension</var> argument will be compared against each of
375     them.</p>
376
377 <h3>See also</h3>
378 <ul>
379 <li><code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code></li>
380 </ul>
381 </div>
382 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
383 <div class="directive-section"><h2><a name="AddInputFilter" id="AddInputFilter">AddInputFilter</a> <a name="addinputfilter" id="addinputfilter">Directive</a></h2>
384 <table class="directive">
385 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps filename extensions to the filters that will process
386 client requests</td></tr>
387 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddInputFilter <var>filter</var>[;<var>filter</var>...]
388 <var>extension</var> [<var>extension</var>] ...</code></td></tr>
389 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
390 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
391 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
392 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
393 </table>
394     <p><code class="directive">AddInputFilter</code> maps the filename extension
395     <var>extension</var> to the <a href="../filter.html">filters</a> which
396     will process client requests and POST input when they are received by
397     the server. This is in addition to any filters defined elsewhere,
398     including the <code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code>
399     directive. This mapping is merged over any already in force, overriding
400     any mappings that already exist for the same <var>extension</var>.</p>
401
402     <p>If more than one <var>filter</var> is specified, they must be separated
403     by semicolons in the order in which they should process the
404     content. The <var>filter</var> is case-insensitive.</p>
405
406     <p>The <var>extension</var> argument is case-insensitive and can
407     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
408     <var>extension</var> argument will be compared against each of
409     them.</p>
410
411
412 <h3>See also</h3>
413 <ul>
414 <li><code class="directive"><a href="#removeinputfilter">RemoveInputFilter</a></code></li>
415 <li><code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code></li>
416 </ul>
417 </div>
418 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
419 <div class="directive-section"><h2><a name="AddLanguage" id="AddLanguage">AddLanguage</a> <a name="addlanguage" id="addlanguage">Directive</a></h2>
420 <table class="directive">
421 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extension to the specified content
422 language</td></tr>
423 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddLanguage <var>language-tag</var> <var>extension</var>
424 [<var>extension</var>] ...</code></td></tr>
425 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
426 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
427 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
428 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
429 </table>
430     <p>The <code class="directive">AddLanguage</code> directive maps the given
431     filename extension to the specified content language.  Files with the
432     filename <var>extension</var> are assigned an HTTP Content-Language
433     value of <var>language-tag</var> corresponding to the language
434     identifiers defined by RFC 3066.
435     This directive overrides any mappings that already exist for the same
436     <var>extension</var>.</p>
437
438     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">AddEncoding x-compress .Z
439 AddLanguage en .en
440 AddLanguage fr .fr</pre>
441 </div>
442
443     <p>Then the document <code>xxxx.en.Z</code> will be treated as
444     being a compressed English document (as will the document
445     <code>xxxx.Z.en</code>). Although the content language is
446     reported to the client, the browser is unlikely to use this
447     information. The <code class="directive">AddLanguage</code> directive is
448     more useful for <a href="../content-negotiation.html">content
449     negotiation</a>, where the server returns one from several documents
450     based on the client's language preference.</p>
451
452     <p>If multiple language assignments are made for the same
453     extension, the last one encountered is the one that is used.
454     That is, for the case of:</p>
455
456     <pre class="prettyprint lang-config">AddLanguage en .en
457 AddLanguage en-gb .en
458 AddLanguage en-us .en</pre>
459
460
461     <p>documents with the extension <code>.en</code> would be treated as
462     being <code>en-us</code>.</p>
463
464     <p>The <var>extension</var> argument is case-insensitive and can
465     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
466     <var>extension</var> argument will be compared against each of
467     them.</p>
468
469 <h3>See also</h3>
470 <ul>
471 <li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li>
472 </ul>
473 </div>
474 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
475 <div class="directive-section"><h2><a name="AddOutputFilter" id="AddOutputFilter">AddOutputFilter</a> <a name="addoutputfilter" id="addoutputfilter">Directive</a></h2>
476 <table class="directive">
477 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps filename extensions to the filters that will process
478 responses from the server</td></tr>
479 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilter <var>filter</var>[;<var>filter</var>...]
480 <var>extension</var> [<var>extension</var>] ...</code></td></tr>
481 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
482 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
483 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
484 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
485 </table>
486     <p>The <code class="directive">AddOutputFilter</code> directive maps the
487     filename extension <var>extension</var> to the <a href="../filter.html">filters</a> which will process responses
488     from the server before they are sent to the client. This is in
489     addition to any filters defined elsewhere, including <code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code> and <code class="directive"><a href="../mod/mod_filter.html#addoutputfilterbytype">AddOutputFilterByType</a></code> directive. This mapping is merged
490     over any already in force, overriding any mappings that already exist
491     for the same <var>extension</var>.</p>
492
493     <p>For example, the following configuration will process all
494     <code>.shtml</code> files for server-side includes and will then
495     compress the output using <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>.</p>
496
497     <pre class="prettyprint lang-config">AddOutputFilter INCLUDES;DEFLATE shtml</pre>
498
499
500     <p>If more than one filter is specified, they must be separated
501     by semicolons in the order in which they should process the
502     content. The <var>filter</var> argument is case-insensitive.</p>
503
504     <p>The <var>extension</var> argument is case-insensitive and can
505     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
506     <var>extension</var> argument will be compared against each of
507     them.</p>
508
509     <p>Note that when defining a set of filters using the
510     <code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code> directive,
511     any definition made will replace any previous definition made by
512     the <code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code>
513     directive.</p>
514
515     <pre class="prettyprint lang-config"># Effective filter "DEFLATE"
516 AddOutputFilter DEFLATE shtml
517 &lt;Location "/foo"&gt;
518   # Effective filter "INCLUDES", replacing "DEFLATE"
519   AddOutputFilter INCLUDES shtml
520 &lt;/Location&gt;
521 &lt;Location "/bar"&gt;
522   # Effective filter "INCLUDES;DEFLATE", replacing "DEFLATE"
523   AddOutputFilter INCLUDES;DEFLATE shtml
524 &lt;/Location&gt;
525 &lt;Location "/bar/baz"&gt;
526   # Effective filter "BUFFER", replacing "INCLUDES;DEFLATE"
527   AddOutputFilter BUFFER shtml
528 &lt;/Location&gt;
529 &lt;Location "/bar/baz/buz"&gt;
530   # No effective filter, replacing "BUFFER"
531   RemoveOutputFilter shtml
532 &lt;/Location&gt;</pre>
533
534
535 <h3>See also</h3>
536 <ul>
537 <li><code class="directive"><a href="#removeoutputfilter">RemoveOutputFilter</a></code></li>
538 <li><code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code></li>
539 </ul>
540 </div>
541 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
542 <div class="directive-section"><h2><a name="AddType" id="AddType">AddType</a> <a name="addtype" id="addtype">Directive</a></h2>
543 <table class="directive">
544 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extensions onto the specified content
545 type</td></tr>
546 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddType <var>media-type</var> <var>extension</var>
547 [<var>extension</var>] ...</code></td></tr>
548 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
549 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
550 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
551 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
552 </table>
553     <p>The <code class="directive">AddType</code> directive maps the given
554     filename extensions onto the specified content
555     type. <var>media-type</var> is the <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media
556     type</a> to use for filenames containing
557     <var>extension</var>. This mapping is added to any already in
558     force, overriding any mappings that already exist for the same
559     <var>extension</var>.</p>
560
561     <div class="note">
562       It is recommended that new media types be added using the
563       <code class="directive">AddType</code> directive rather than changing the
564       <code class="directive"><a href="#typesconfig">TypesConfig</a></code> file.
565     </div>
566
567     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">AddType image/gif .gif</pre>
568 </div>
569
570     <p>Or, to specify multiple file extensions in one directive:</p>
571
572     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">AddType image/jpeg jpeg jpg jpe</pre>
573 </div>
574
575     <p>The <var>extension</var> argument is case-insensitive and can
576     be specified with or without a leading dot. Filenames may have <a href="#multipleext">multiple extensions</a> and the
577     <var>extension</var> argument will be compared against each of
578     them.</p>
579
580     <p>A simmilar effect to <code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code>'s
581     <code class="directive"><a href="../mod/mod_negotiation.html#languagepriority">LanguagePriority</a></code>
582     can be achieved by qualifying a <var>media-type</var> with
583     <code>qs</code>:</p>
584
585     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">AddType application/rss+xml;qs=0.8 .xml</pre>
586 </div>
587
588     <p>This is useful in situations, <em>e.g.</em> when a client
589     requesting <code>Accept: */*</code> can not actually processes
590     the content returned by the server.</p>
591
592     <p>This directive primarily configures the content types generated for
593     static files served out of the filesystem.  For resources other than
594     static files, where the generator of the response typically specifies
595     a Content-Type, this directive has no effect.</p>
596
597
598     <div class="note"><h3>Note</h3>
599     <p>If no handler is explicitly set for a request, the specified content
600     type will also be used as the handler name. </p>
601    
602     <p>When explicit directives such as 
603     <code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code> or 
604     <code class="directive"><a href="#addhandler">AddHandler</a></code> do not apply 
605     to the current request, the internal handler name normally set by those
606     directives is instead set to the content type specified by this directive. 
607     </p> 
608     <p>
609     This is a historical behavior that may be used by some third-party modules 
610     (such as mod_php) for taking responsibility for the matching request.
611     </p>
612
613     <p>Configurations that rely on such "synthetic" types should be avoided. 
614     Additionally, configurations that restrict access to 
615     <code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code> or 
616     <code class="directive"><a href="#addhandler">AddHandler</a></code> should
617     restrict access to this directive as well.</p>
618     </div>
619
620
621 <h3>See also</h3>
622 <ul>
623 <li><code class="directive"><a href="../mod/core.html#forcetype">ForceType</a></code></li>
624 <li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li>
625 </ul>
626 </div>
627 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
628 <div class="directive-section"><h2><a name="DefaultLanguage" id="DefaultLanguage">DefaultLanguage</a> <a name="defaultlanguage" id="defaultlanguage">Directive</a></h2>
629 <table class="directive">
630 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a default language-tag to be sent in the Content-Language
631 header field for all resources in the current context that have not been
632 assigned a language-tag by some other means.</td></tr>
633 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultLanguage <var>language-tag</var></code></td></tr>
634 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
635 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
636 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
637 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
638 </table>
639     <p>The <code class="directive">DefaultLanguage</code> directive tells Apache
640     that all resources in the directive's scope (<em>e.g.</em>, all resources
641     covered by the current <code class="directive"><a href="../mod/core.html#directory">&lt;Directory&gt;</a></code> container) that don't have an explicit language
642     extension (such as <code>.fr</code> or <code>.de</code> as configured
643     by <code class="directive"><a href="#addlanguage">AddLanguage</a></code>) should be
644     assigned a Content-Language of <var>language-tag</var>. This allows
645     entire directory trees to be marked as containing Dutch content, for
646     instance, without having to rename each file. Note that unlike using
647     extensions to specify languages, <code class="directive">DefaultLanguage</code>
648     can only specify a single language.</p>
649
650     <p>If no <code class="directive">DefaultLanguage</code> directive is in force
651     and a file does not have any language extensions as configured
652     by <code class="directive"><a href="#addlanguage">AddLanguage</a></code>, then no
653     Content-Language header field will be generated.</p>
654
655     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">DefaultLanguage en</pre>
656 </div>
657
658 <h3>See also</h3>
659 <ul>
660 <li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li>
661 </ul>
662 </div>
663 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
664 <div class="directive-section"><h2><a name="ModMimeUsePathInfo" id="ModMimeUsePathInfo">ModMimeUsePathInfo</a> <a name="modmimeusepathinfo" id="modmimeusepathinfo">Directive</a></h2>
665 <table class="directive">
666 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Tells <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> to treat <code>path_info</code>
667 components as part of the filename</td></tr>
668 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ModMimeUsePathInfo On|Off</code></td></tr>
669 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ModMimeUsePathInfo Off</code></td></tr>
670 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
671 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
672 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
673 </table>
674     <p>The <code class="directive">ModMimeUsePathInfo</code> directive is used to
675     combine the filename with the <code>path_info</code> URL component to
676     apply <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code>'s directives to the request. The default
677     value is <code>Off</code> - therefore, the <code>path_info</code>
678     component is ignored.</p>
679
680     <p>This directive is recommended when you have a virtual filesystem.</p>
681
682     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ModMimeUsePathInfo On</pre>
683 </div>
684
685     <p>If you have a request for <code>/index.php/foo.shtml</code>
686     <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> will now treat the
687     incoming request as <code>/index.php/foo.shtml</code> and directives
688     like <code>AddOutputFilter INCLUDES .shtml</code> will add the
689     <code>INCLUDES</code> filter to the request. If <code class="directive">ModMimeUsePathInfo</code> is not set, the
690     <code>INCLUDES</code> filter will not be added. This will work
691     analogously for virtual paths, such as those defined by
692     <code class="directive">&lt;Location&gt;</code></p>
693
694 <h3>See also</h3>
695 <ul>
696 <li><code class="directive"><a href="../mod/core.html#acceptpathinfo">AcceptPathInfo</a></code></li>
697 </ul>
698 </div>
699 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
700 <div class="directive-section"><h2><a name="MultiviewsMatch" id="MultiviewsMatch">MultiviewsMatch</a> <a name="multiviewsmatch" id="multiviewsmatch">Directive</a></h2>
701 <table class="directive">
702 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The types of files that will be included when searching for
703 a matching file with MultiViews</td></tr>
704 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MultiviewsMatch Any|NegotiatedOnly|Filters|Handlers
705 [Handlers|Filters]</code></td></tr>
706 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MultiviewsMatch NegotiatedOnly</code></td></tr>
707 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
708 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
709 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
710 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
711 </table>
712     <p><code class="directive">MultiviewsMatch</code> permits three different
713     behaviors for <a href="mod_negotiation.html">mod_negotiation</a>'s
714     Multiviews feature.  Multiviews allows a request for a file,
715     <em>e.g.</em> <code>index.html</code>, to match any negotiated
716     extensions following the base request, <em>e.g.</em>
717     <code>index.html.en</code>, <code>index.html.fr</code>, or
718     <code>index.html.gz</code>.</p>
719
720     <p>The <code>NegotiatedOnly</code> option provides that every extension
721     following the base name must correlate to a recognized
722     <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> extension for content negotiation, <em>e.g.</em>
723     Charset, Content-Type, Language, or Encoding.  This is the strictest
724     implementation with the fewest unexpected side effects, and is the
725     default behavior.</p>
726
727     <p>To include extensions associated with Handlers and/or Filters,
728     set the <code class="directive">MultiviewsMatch</code> directive to either
729     <code>Handlers</code>, <code>Filters</code>, or both option keywords.
730     If all other factors are equal, the smallest file will be served,
731     <em>e.g.</em> in deciding between <code>index.html.cgi</code> of 500
732     bytes and <code>index.html.pl</code> of 1000 bytes, the <code>.cgi</code>
733     file would win in this example. Users of <code>.asis</code> files
734     might prefer to use the Handler option, if <code>.asis</code> files are
735     associated with the <code>asis-handler</code>.</p>
736
737     <p>You may finally allow <code>Any</code> extensions to match, even if
738     <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> doesn't recognize the extension. This can cause
739     unpredictable results, such as serving .old or .bak files the webmaster
740     never expected to be served.</p>
741
742     <p>For example, the following configuration will allow handlers
743     and filters to participate in Multviews, but will exclude unknown
744     files:</p>
745
746     <pre class="prettyprint lang-config">MultiviewsMatch Handlers Filters</pre>
747
748
749     <p><code class="directive">MultiviewsMatch</code> is not allowed in a
750     <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code> or <code class="directive"><a href="../mod/core.html#locationmatch">&lt;LocationMatch&gt;</a></code> section.</p>
751
752
753 <h3>See also</h3>
754 <ul>
755 <li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li>
756 <li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li>
757 </ul>
758 </div>
759 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
760 <div class="directive-section"><h2><a name="RemoveCharset" id="RemoveCharset">RemoveCharset</a> <a name="removecharset" id="removecharset">Directive</a></h2>
761 <table class="directive">
762 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any character set associations for a set of file
763 extensions</td></tr>
764 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveCharset <var>extension</var> [<var>extension</var>]
765 ...</code></td></tr>
766 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
767 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
768 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
769 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
770 </table>
771     <p>The <code class="directive">RemoveCharset</code> directive removes any
772     character set associations for files with the given extensions.
773     This allows <code>.htaccess</code> files in subdirectories to
774     undo any associations inherited from parent directories or the
775     server config files.</p>
776
777     <p>The <var>extension</var> argument is case-insensitive and can
778     be specified with or without a leading dot.</p>
779
780     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">RemoveCharset .html .shtml</pre>
781 </div>
782
783 </div>
784 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
785 <div class="directive-section"><h2><a name="RemoveEncoding" id="RemoveEncoding">RemoveEncoding</a> <a name="removeencoding" id="removeencoding">Directive</a></h2>
786 <table class="directive">
787 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any content encoding associations for a set of file
788 extensions</td></tr>
789 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveEncoding <var>extension</var> [<var>extension</var>]
790 ...</code></td></tr>
791 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
792 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
793 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
794 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
795 </table>
796     <p>The <code class="directive">RemoveEncoding</code> directive removes any
797     encoding associations for files with the given extensions. This
798     allows <code>.htaccess</code> files in subdirectories to undo
799     any associations inherited from parent directories or the
800     server config files. An example of its use might be:</p>
801
802     <div class="example"><h3>/foo/.htaccess:</h3><pre class="prettyprint lang-config">AddEncoding x-gzip .gz
803 AddType text/plain .asc
804 &lt;Files "*.gz.asc"&gt;
805     RemoveEncoding .gz
806 &lt;/Files&gt;</pre>
807 </div>
808
809     <p>This will cause <code>foo.gz</code> to be marked as being
810     encoded with the gzip method, but <code>foo.gz.asc</code> as an
811     unencoded plaintext file.</p>
812
813     <div class="note"><h3>Note</h3>
814       <p><code class="directive">RemoveEncoding</code> directives are processed
815       <em>after</em> any <code class="directive"><a href="#addencoding">AddEncoding</a></code>
816       directives, so it is possible they may undo the effects of the latter
817       if both occur within the same directory configuration.</p>
818     </div>
819
820     <p>The <var>extension</var> argument is case-insensitive and can
821     be specified with or without a leading dot.</p>
822
823 </div>
824 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
825 <div class="directive-section"><h2><a name="RemoveHandler" id="RemoveHandler">RemoveHandler</a> <a name="removehandler" id="removehandler">Directive</a></h2>
826 <table class="directive">
827 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any handler associations for a set of file
828 extensions</td></tr>
829 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveHandler <var>extension</var> [<var>extension</var>]
830 ...</code></td></tr>
831 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
832 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
833 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
834 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
835 </table>
836     <p>The <code class="directive">RemoveHandler</code> directive removes any
837     handler associations for files with the given extensions. This allows
838     <code>.htaccess</code> files in subdirectories to undo any
839     associations inherited from parent directories or the server
840     config files. An example of its use might be:</p>
841
842     <div class="example"><h3>/foo/.htaccess:</h3><pre class="prettyprint lang-config">AddHandler server-parsed .html</pre>
843 </div>
844
845     <div class="example"><h3>/foo/bar/.htaccess:</h3><pre class="prettyprint lang-config">RemoveHandler .html</pre>
846 </div>
847
848     <p>This has the effect of returning <code>.html</code> files in
849     the <code>/foo/bar</code> directory to being treated as normal
850     files, rather than as candidates for parsing (see the <code class="module"><a href="../mod/mod_include.html">mod_include</a></code> module).</p>
851
852     <p>The <var>extension</var> argument is case-insensitive and can
853     be specified with or without a leading dot.</p>
854
855 </div>
856 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
857 <div class="directive-section"><h2><a name="RemoveInputFilter" id="RemoveInputFilter">RemoveInputFilter</a> <a name="removeinputfilter" id="removeinputfilter">Directive</a></h2>
858 <table class="directive">
859 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any input filter associations for a set of file
860 extensions</td></tr>
861 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveInputFilter <var>extension</var> [<var>extension</var>]
862 ...</code></td></tr>
863 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
864 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
865 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
866 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
867 </table>
868     <p>The <code class="directive">RemoveInputFilter</code> directive removes any
869     input <a href="../filter.html">filter</a> associations for files with
870     the given extensions.
871     This allows <code>.htaccess</code> files in subdirectories to
872     undo any associations inherited from parent directories or the
873     server config files.</p>
874
875     <p>The <var>extension</var> argument is case-insensitive and can
876     be specified with or without a leading dot.</p>
877
878 <h3>See also</h3>
879 <ul>
880 <li><code class="directive"><a href="#addinputfilter">AddInputFilter</a></code></li>
881 <li><code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code></li>
882 </ul>
883 </div>
884 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
885 <div class="directive-section"><h2><a name="RemoveLanguage" id="RemoveLanguage">RemoveLanguage</a> <a name="removelanguage" id="removelanguage">Directive</a></h2>
886 <table class="directive">
887 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any language associations for a set of file
888 extensions</td></tr>
889 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveLanguage <var>extension</var> [<var>extension</var>]
890 ...</code></td></tr>
891 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
892 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
893 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
894 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
895 </table>
896     <p>The <code class="directive">RemoveLanguage</code> directive removes any
897     language associations for files with the given extensions. This
898     allows <code>.htaccess</code> files in subdirectories to undo
899     any associations inherited from parent directories or the
900     server config files.</p>
901
902     <p>The <var>extension</var> argument is case-insensitive and can
903     be specified with or without a leading dot.</p>
904
905 </div>
906 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
907 <div class="directive-section"><h2><a name="RemoveOutputFilter" id="RemoveOutputFilter">RemoveOutputFilter</a> <a name="removeoutputfilter" id="removeoutputfilter">Directive</a></h2>
908 <table class="directive">
909 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any output filter associations for a set of file
910 extensions</td></tr>
911 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveOutputFilter <var>extension</var> [<var>extension</var>]
912 ...</code></td></tr>
913 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
914 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
915 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
916 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
917 </table>
918     <p>The <code class="directive">RemoveOutputFilter</code> directive removes any
919     output <a href="../filter.html">filter</a> associations for files with
920     the given extensions.
921     This allows <code>.htaccess</code> files in subdirectories to
922     undo any associations inherited from parent directories or the
923     server config files.</p>
924
925     <p>The <var>extension</var> argument is case-insensitive and can
926     be specified with or without a leading dot.</p>
927
928     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">RemoveOutputFilter shtml</pre>
929 </div>
930
931 <h3>See also</h3>
932 <ul>
933 <li><code class="directive"><a href="#addoutputfilter">AddOutputFilter</a></code></li>
934 </ul>
935 </div>
936 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
937 <div class="directive-section"><h2><a name="RemoveType" id="RemoveType">RemoveType</a> <a name="removetype" id="removetype">Directive</a></h2>
938 <table class="directive">
939 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any content type associations for a set of file
940 extensions</td></tr>
941 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveType <var>extension</var> [<var>extension</var>]
942 ...</code></td></tr>
943 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>virtual host, directory, .htaccess</td></tr>
944 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
945 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
946 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
947 </table>
948     <p>The <code class="directive">RemoveType</code> directive removes any
949     <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media type</a> associations for files with
950     the given extensions. This allows <code>.htaccess</code> files in
951     subdirectories to undo any associations inherited from parent
952     directories or the server config files. An example of its use
953     might be:</p>
954
955     <div class="example"><h3>/foo/.htaccess:</h3><pre class="prettyprint lang-config">RemoveType .cgi</pre>
956 </div>
957
958     <p>This will remove any special handling of <code>.cgi</code>
959     files in the <code>/foo/</code> directory and any beneath it,
960     causing responses containing those files to omit the HTTP
961     Content-Type header field.</p>
962
963     <div class="note"><h3>Note</h3>
964       <p><code class="directive">RemoveType</code> directives are processed
965       <em>after</em> any <code class="directive"><a href="#addtype">AddType</a></code>
966       directives, so it is possible they may undo the effects of the
967       latter if both occur within the same directory configuration.</p>
968     </div>
969
970     <p>The <var>extension</var> argument is case-insensitive and can
971     be specified with or without a leading dot.</p>
972
973 </div>
974 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
975 <div class="directive-section"><h2><a name="TypesConfig" id="TypesConfig">TypesConfig</a> <a name="typesconfig" id="typesconfig">Directive</a></h2>
976 <table class="directive">
977 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The location of the <code>mime.types</code> file</td></tr>
978 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>TypesConfig <var>file-path</var></code></td></tr>
979 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>TypesConfig conf/mime.types</code></td></tr>
980 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
981 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
982 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr>
983 </table>
984     <p>The <code class="directive">TypesConfig</code> directive sets the
985     location of the <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media types</a>
986     configuration file. <var>File-path</var> is relative to the
987     <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>. This file sets
988     the default list of mappings from filename extensions to content
989     types. Most administrators use the <code>mime.types</code> file
990     provided by their OS, which associates common filename
991     extensions with the official list of IANA registered media types
992     maintained at <a href="http://www.iana.org/assignments/media-types/index.html">http://www.iana.org/assignments/media-types/index.html</a>
993     as well as a large number of unofficial types.  This
994     simplifies the <code>httpd.conf</code> file by providing the
995     majority of media-type definitions, and may be overridden by
996     <code class="directive"><a href="#addtype">AddType</a></code> directives as
997     needed. You should not edit the <code>mime.types</code> file,
998     because it may be replaced when you upgrade your server.</p>
999
1000     <p>The file contains lines in the format of the arguments to
1001     an <code class="directive"><a href="#addtype">AddType</a></code> directive:</p>
1002
1003     <div class="example"><p><code>
1004       <var>media-type</var> [<var>extension</var>] ...
1005     </code></p></div>
1006
1007     <p>The case of the extension does not matter. Blank lines, and lines
1008     beginning with a hash character (<code>#</code>) are ignored.
1009     Empty lines are there for completeness (of the mime.types file).
1010     Apache httpd can still determine these types with <code class="module"><a href="../mod/mod_mime_magic.html">mod_mime_magic</a></code>.
1011     </p>
1012
1013     <div class="note">
1014       Please do <strong>not</strong> send requests to the Apache HTTP
1015       Server Project to add any new entries in the distributed
1016       <code>mime.types</code> file unless (1) they are already
1017       registered with IANA, and (2) they use widely accepted,
1018       non-conflicting filename extensions across platforms.
1019       <code>category/x-subtype</code> requests will be automatically
1020       rejected, as will any new two-letter extensions as they will
1021       likely conflict later with the already crowded language and
1022       character set namespace.
1023     </div>
1024
1025 <h3>See also</h3>
1026 <ul>
1027 <li><code class="module"><a href="../mod/mod_mime_magic.html">mod_mime_magic</a></code></li>
1028 </ul>
1029 </div>
1030 </div>
1031 <div class="bottomlang">
1032 <p><span>Available Languages: </span><a href="../en/mod/mod_mime.html" title="English">&nbsp;en&nbsp;</a> |
1033 <a href="../ja/mod/mod_mime.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
1034 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
1035 <script type="text/javascript"><!--//--><![CDATA[//><!--
1036 var comments_shortname = 'httpd';
1037 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_mime.html';
1038 (function(w, d) {
1039     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
1040         d.write('<div id="comments_thread"><\/div>');
1041         var s = d.createElement('script');
1042         s.type = 'text/javascript';
1043         s.async = true;
1044         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
1045         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
1046     }
1047     else {
1048         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
1049     }
1050 })(window, document);
1051 //--><!]]></script></div><div id="footer">
1052 <p class="apache">Copyright 2016 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
1053 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
1054 if (typeof(prettyPrint) !== 'undefined') {
1055     prettyPrint();
1056 }
1057 //--><!]]></script>
1058 </body></html>