switch to a 60 bit hash
[httpd-crcsyncproxy.git] / docs / manual / mod / mod_mime.xml
blob292f38af01e97ff0e7ee7057f252c32af9daacb8
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
14      http://www.apache.org/licenses/LICENSE-2.0
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
23 <modulesynopsis metafile="mod_mime.xml.meta">
25 <name>mod_mime</name>
26 <description>Associates the requested filename's extensions
27     with the file's behavior (handlers and filters)
28     and content (mime-type, language, character set and
29     encoding)</description>
30 <status>Base</status>
31 <sourcefile>mod_mime.c</sourcefile>
32 <identifier>mime_module</identifier>
34 <summary>
35     <p>This module is used to assign content metadata to the content
36     selected for an HTTP response by mapping patterns in the
37     URI or filenames to the metadata values.  For example, the filename
38     extensions of content files often define the content's Internet
39     media type, language, character set, and content-encoding. This
40     information is sent in HTTP messages containing that content and
41     used in content negotiation when selecting alternatives, such that
42     the user's preferences are respected when choosing one of several
43     possible contents to serve. See
44     <module>mod_negotiation</module> for more information
45     about <a href="../content-negotiation.html">content negotiation</a>.</p>
47     <p>The directives <directive
48     module="mod_mime">AddCharset</directive>, <directive
49     module="mod_mime">AddEncoding</directive>, <directive
50     module="mod_mime">AddLanguage</directive> and <directive
51     module="mod_mime">AddType</directive> are all used to map file
52     extensions onto the metadata for that file. Respectively
53     they set the character set, content-encoding, content-language,
54     and <glossary>media-type</glossary> (content-type) of documents.  The directive <directive
55     module="mod_mime">TypesConfig</directive> is used to specify a
56     file which also maps extensions onto media types. </p>
58     <p>In addition, <module>mod_mime</module> may define the <a
59     href="../handler.html">handler</a> and <a
60     href="../filter.html">filters</a> that originate and process
61     content.  The directives <directive
62     module="mod_mime">AddHandler</directive>, <directive
63     module="mod_mime">AddOutputFilter</directive>, and <directive
64     module="mod_mime">AddInputFilter</directive> control the modules
65     or scripts that serve the document.  The <directive
66     module="mod_mime">MultiviewsMatch</directive> directive allows
67     <module>mod_negotiation</module> to consider these file extensions
68     to be included when testing Multiviews matches.</p>
70     <p>While <module>mod_mime</module> associates metadata
71     with filename extensions, the <module>core</module> server
72     provides directives that are used to associate all the files in a
73     given container (<em>e.g.</em>, <directive type="section"
74     module="core">Location</directive>, <directive type="section"
75     module="core">Directory</directive>, or <directive type="section"
76     module="core">Files</directive>) with particular
77     metadata. These directives include <directive
78     module="core">ForceType</directive>, <directive
79     module="core">SetHandler</directive>, <directive
80     module="core">SetInputFilter</directive>, and <directive
81     module="core">SetOutputFilter</directive>.  The core directives
82     override any filename extension mappings defined in
83     <module>mod_mime</module>.</p>
85     <p>Note that changing the metadata for a file does not
86     change the value of the <code>Last-Modified</code> header.
87     Thus, previously cached copies may still be used by a client or
88     proxy, with the previous headers. If you change the
89     metadata (language, content type, character set or
90     encoding) you may need to 'touch' affected files (updating
91     their last modified date) to ensure that all visitors are
92     receive the corrected content headers.</p>
93 </summary>
94 <seealso><directive
95 module="mod_mime_magic">MimeMagicFile</directive></seealso>
96 <seealso><directive module="core">AddDefaultCharset</directive></seealso>
97 <seealso><directive module="core">ForceType</directive></seealso>
98 <seealso><directive module="core">SetHandler</directive></seealso>
99 <seealso><directive module="core">SetInputFilter</directive></seealso>
100 <seealso><directive module="core">SetOutputFilter</directive></seealso>
102 <section id="multipleext"><title>Files with Multiple Extensions</title>
103     <p>Files can have more than one extension; the order of the
104     extensions is <em>normally</em> irrelevant. For example, if the
105     file <code>welcome.html.fr</code> maps onto content type
106     <code>text/html</code> and language French then the file
107     <code>welcome.fr.html</code> will map onto exactly the same
108     information.  If more than one extension is given that maps onto
109     the same type of metadata, then the one to the right will
110     be used, except for languages and content encodings. For example,
111     if <code>.gif</code> maps to the <glossary>media-type</glossary>
112     <code>image/gif</code> and <code>.html</code> maps to the
113     media-type <code>text/html</code>, then the file
114     <code>welcome.gif.html</code> will be associated with the
115     media-type <code>text/html</code>.</p>
117     <p><a href="#charset-lang">Languages</a> and <a href="#contentencoding"
118     >content encodings</a> are treated accumulative, because one can assign
119     more than one language or encoding to a particular resource. For example,
120     the file <code>welcome.html.en.de</code> will be delivered with
121     <code>Content-Language: en, de</code> and <code>Content-Type:
122     text/html</code>.</p>
124     <p>Care should be taken when a file with multiple extensions
125     gets associated with both a <glossary>media-type</glossary>
126     and a handler. This will
127     usually result in the request being handled by the module associated
128     with the handler. For example, if the <code>.imap</code>
129     extension is mapped to the handler <code>imap-file</code> (from
130     <module>mod_imagemap</module>) and the <code>.html</code> extension is
131     mapped to the media-type <code>text/html</code>, then the file
132     <code>world.imap.html</code> will be associated with both the
133     <code>imap-file</code> handler and <code>text/html</code> media-type.
134     When it is processed, the <code>imap-file</code> handler will be used,
135     and so it will be treated as a <module>mod_imagemap</module> imagemap
136     file.</p>
138     <p>If you would prefer only the last dot-separated part of the
139     filename to be mapped to a particular piece of meta-data, then do
140     not use the <code>Add*</code> directives. For example, if you wish
141     to have the file <code>foo.html.cgi</code> processed as a CGI
142     script, but not the file <code>bar.cgi.html</code>, then instead
143     of using <code>AddHandler cgi-script .cgi</code>, use</p>
145     <example><title>Configure handler based on final extension only</title>
146     &lt;FilesMatch \.cgi$&gt;
147     <indent>
148       SetHandler cgi-script
149     </indent>
150     &lt;/FilesMatch&gt;
151     </example>
153 </section>
155 <section id="contentencoding"><title>Content encoding</title>
156     <p>A file of a particular <glossary>media-type</glossary> can additionally be encoded a
157     particular way to simplify transmission over the Internet.
158     While this usually will refer to compression, such as
159     <code>gzip</code>, it can also refer to encryption, such a
160     <code>pgp</code> or to an encoding such as UUencoding, which is
161     designed for transmitting a binary file in an ASCII (text)
162     format.</p>
164     <p>The <a href="http://www.ietf.org/rfc/rfc2616.txt">HTTP/1.1
165     RFC</a>, section 14.11 puts it this way:</p>
167     <blockquote cite="http://www.ietf.org/rfc/rfc2616.txt">
168       <p>The Content-Encoding entity-header field is used as a modifier to
169       the media-type. When present, its value indicates what additional
170       content codings have been applied to the entity-body, and thus what
171       decoding mechanisms must be applied in order to obtain the media-type
172       referenced by the Content-Type header field. Content-Encoding is
173       primarily used to allow a document to be compressed without losing
174       the identity of its underlying media type.</p>
175     </blockquote>
177     <p>By using more than one file extension (see <a
178     href="#multipleext">section above about multiple file
179     extensions</a>), you can indicate that a file is of a
180     particular <em>type</em>, and also has a particular
181     <em>encoding</em>. </p>
183     <p>For example, you may have a file which is a Microsoft Word
184     document, which is pkzipped to reduce its size. If the
185     <code>.doc</code> extension is associated with the Microsoft
186     Word file type, and the <code>.zip</code> extension is
187     associated with the pkzip file encoding, then the file
188     <code>Resume.doc.zip</code> would be known to be a pkzip'ed Word
189     document.</p>
191     <p>Apache sends a <code>Content-encoding</code> header with the
192     resource, in order to tell the client browser about the
193     encoding method.</p>
195     <example>Content-encoding: pkzip</example>
196 </section>
198 <section id="charset-lang"><title>Character sets and languages</title>
199     <p>In addition to file type and the file encoding,
200     another important piece of information is what language a
201     particular document is in, and in what character set the file
202     should be displayed. For example, the document might be written
203     in the Vietnamese alphabet, or in Cyrillic, and should be
204     displayed as such. This information, also, is transmitted in
205     HTTP headers.</p>
207     <p>The character set, language, encoding and mime type are all 
208     used in the process of content negotiation (See 
209     <module>mod_negotiation</module>) to determine
210     which document to give to the client, when there are
211     alternative documents in more than one character set, language, 
212     encoding or mime type. All filename extensions associations
213     created with <directive module="mod_mime">AddCharset</directive>,
214     <directive module="mod_mime">AddEncoding</directive>, <directive
215     module="mod_mime">AddLanguage</directive> and <directive
216     module="mod_mime">AddType</directive> directives
217     (and extensions listed in the <directive module="mod_mime_magic"
218     >MimeMagicFile</directive>) participate in this select process.
219     Filename extensions that are only associated using the <directive
220     module="mod_mime">AddHandler</directive>, <directive module="mod_mime"
221     >AddInputFilter</directive> or <directive module="mod_mime"
222     >AddOutputFilter</directive> directives may be included or excluded
223     from matching by using the <directive module="mod_mime"
224     >MultiviewsMatch</directive> directive.</p>
226     <section id="charset"><title>Charset</title>
227       <p>To convey this further information, Apache optionally sends
228       a <code>Content-Language</code> header, to specify the language
229       that the document is in, and can append additional information
230       onto the <code>Content-Type</code> header to indicate the
231       particular character set that should be used to correctly
232       render the information.</p>
234       <example>
235         Content-Language: en, fr<br />
236         Content-Type: text/plain; charset=ISO-8859-1
237       </example>
239       <p>The language specification is the two-letter abbreviation
240       for the language. The <code>charset</code> is the name of the
241       particular character set which should be used.</p>
242     </section>
243 </section>
245 <directivesynopsis>
246 <name>AddCharset</name>
247 <description>Maps the given filename extensions to the specified content
248 charset</description>
249 <syntax>AddCharset <var>charset</var> <var>extension</var>
250 [<var>extension</var>] ...</syntax>
251 <contextlist><context>server config</context><context>virtual host</context>
252 <context>directory</context><context>.htaccess</context></contextlist>
253 <override>FileInfo</override>
255 <usage>
256     <p>The <directive>AddCharset</directive> directive maps the given
257     filename extensions to the specified content charset (the Internet
258     registered name for a given character encoding). <var>charset</var>
259     is the <a href="http://www.iana.org/assignments/character-sets">media
260     type's charset parameter</a> for resources with filenames containing
261     <var>extension</var>. This mapping is added to any already in force,
262     overriding any mappings that already exist for the same
263     <var>extension</var>.</p>
265     <example><title>Example</title>
266       AddLanguage ja .ja<br />
267       AddCharset EUC-JP .euc<br />
268       AddCharset ISO-2022-JP .jis<br />
269       AddCharset SHIFT_JIS .sjis
270     </example>
272     <p>Then the document <code>xxxx.ja.jis</code> will be treated
273     as being a Japanese document whose charset is <code>ISO-2022-JP</code>
274     (as will the document <code>xxxx.jis.ja</code>). The
275     <directive>AddCharset</directive> directive is useful for both to
276     inform the client about the character encoding of the document so that
277     the document can be interpreted and displayed appropriately, and for <a
278     href="../content-negotiation.html">content negotiation</a>,
279     where the server returns one from several documents based on
280     the client's charset preference.</p>
282     <p>The <var>extension</var> argument is case-insensitive and can
283     be specified with or without a leading dot. Filenames may have <a
284     href="#multipleext">multiple extensions</a> and the
285     <var>extension</var> argument will be compared against each of
286     them.</p>
288 </usage>
289 <seealso><module>mod_negotiation</module></seealso>
290 <seealso><directive module="core">AddDefaultCharset</directive></seealso>
291 </directivesynopsis>
293 <directivesynopsis>
294 <name>AddEncoding</name>
295 <description>Maps the given filename extensions to the specified encoding
296 type</description>
297 <syntax>AddEncoding <var>encoding</var> <var>extension</var>
298 [<var>extension</var>] ...</syntax>
299 <contextlist><context>server config</context><context>virtual host</context>
300 <context>directory</context><context>.htaccess</context></contextlist>
301 <override>FileInfo</override>
303 <usage>
304     <p>The <directive>AddEncoding</directive> directive maps the given
305     filename extensions to the specified HTTP content-encoding.
306     <var>encoding</var> is the HTTP content coding to append to the
307     value of the Content-Encoding header field for documents named with the
308     <var>extension</var>. This mapping is added to any already in force,
309     overriding any mappings that already exist for the same
310     <var>extension</var>.</p>
312     <example><title>Example</title>
313       AddEncoding x-gzip .gz<br />
314       AddEncoding x-compress .Z
315     </example>
317     <p>This will cause filenames containing the <code>.gz</code> extension
318     to be marked as encoded using the <code>x-gzip</code> encoding, and
319     filenames containing the <code>.Z</code> extension to be marked as
320     encoded with <code>x-compress</code>.</p>
322     <p>Old clients expect <code>x-gzip</code> and <code>x-compress</code>,
323     however the standard dictates that they're equivalent to
324     <code>gzip</code> and <code>compress</code> respectively. Apache does
325     content encoding comparisons by ignoring any leading <code>x-</code>.
326     When responding with an encoding Apache will use whatever form
327     (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the
328     client requested. If the client didn't specifically request a
329     particular form Apache will use the form given by the
330     <code>AddEncoding</code> directive. To make this long story
331     short, you should always use <code>x-gzip</code> and
332     <code>x-compress</code> for these two specific encodings. More
333     recent encodings, such as <code>deflate</code>, should be
334     specified without the <code>x-</code>.</p>
336     <p>The <var>extension</var> argument is case-insensitive and can
337     be specified with or without a leading dot. Filenames may have <a
338     href="#multipleext">multiple extensions</a> and the
339     <var>extension</var> argument will be compared against each of
340     them.</p>
341 </usage>
342 </directivesynopsis>
344 <directivesynopsis>
345 <name>AddHandler</name>
346 <description>Maps the filename extensions to the specified
347 handler</description>
348 <syntax>AddHandler <var>handler-name</var> <var>extension</var>
349 [<var>extension</var>] ...</syntax>
350 <contextlist><context>server config</context><context>virtual host</context>
351 <context>directory</context><context>.htaccess</context></contextlist>
352 <override>FileInfo</override>
354 <usage>
355     <p>Files having the name <var>extension</var> will be served by the
356     specified <var><a href="../handler.html">handler-name</a></var>. This
357     mapping is added to any already in force, overriding any mappings that
358     already exist for the same <var>extension</var>. For example, to
359     activate CGI scripts with the file extension <code>.cgi</code>, you
360     might use:</p>
362     <example>
363       AddHandler cgi-script .cgi
364     </example>
366     <p>Once that has been put into your httpd.conf file, any file containing
367     the <code>.cgi</code> extension will be treated as a CGI program.</p>
369     <p>The <var>extension</var> argument is case-insensitive and can
370     be specified with or without a leading dot. Filenames may have <a
371     href="#multipleext">multiple extensions</a> and the
372     <var>extension</var> argument will be compared against each of
373     them.</p>
374 </usage>
375 <seealso><directive module="core">SetHandler</directive></seealso>
376 </directivesynopsis>
378 <directivesynopsis>
379 <name>AddInputFilter</name>
380 <description>Maps filename extensions to the filters that will process
381 client requests</description>
382 <syntax>AddInputFilter <var>filter</var>[;<var>filter</var>...]
383 <var>extension</var> [<var>extension</var>] ...</syntax>
384 <contextlist><context>server config</context><context>virtual host</context>
385 <context>directory</context><context>.htaccess</context></contextlist>
386 <override>FileInfo</override>
387 <compatibility>AddInputFilter is only available in Apache 2.0.26 and
388 later.</compatibility>
390 <usage>
391     <p><directive>AddInputFilter</directive> maps the filename extension
392     <var>extension</var> to the <a href="../filter.html">filters</a> which
393     will process client requests and POST input when they are received by
394     the server. This is in addition to any filters defined elsewhere,
395     including the <directive module="core">SetInputFilter</directive>
396     directive. This mapping is merged over any already in force, overriding
397     any mappings that already exist for the same <var>extension</var>.</p>
399     <p>If more than one <var>filter</var> is specified, they must be separated
400     by semicolons in the order in which they should process the
401     content. The <var>filter</var> is case-insensitive.</p>
403     <p>The <var>extension</var> argument is case-insensitive and can
404     be specified with or without a leading dot. Filenames may have <a
405     href="#multipleext">multiple extensions</a> and the
406     <var>extension</var> argument will be compared against each of
407     them.</p>
409 </usage>
410 <seealso><directive module="mod_mime">RemoveInputFilter</directive></seealso>
411 <seealso><directive module="core">SetInputFilter</directive></seealso>
412 </directivesynopsis>
414 <directivesynopsis>
415 <name>AddLanguage</name>
416 <description>Maps the given filename extension to the specified content
417 language</description>
418 <syntax>AddLanguage <var>language-tag</var> <var>extension</var>
419 [<var>extension</var>] ...</syntax>
420 <contextlist><context>server config</context><context>virtual host</context>
421 <context>directory</context><context>.htaccess</context></contextlist>
422 <override>FileInfo</override>
424 <usage>
425     <p>The <directive>AddLanguage</directive> directive maps the given
426     filename extension to the specified content language.  Files with the
427     filename <var>extension</var> are assigned an HTTP Content-Language
428     value of <var>language-tag</var> corresponding to the language
429     identifiers defined by RFC 3066.
430     This directive overrides any mappings that already exist for the same
431     <var>extension</var>.</p>
433     <example><title>Example</title>
434       AddEncoding x-compress .Z<br />
435       AddLanguage en .en<br />
436       AddLanguage fr .fr
437     </example>
439     <p>Then the document <code>xxxx.en.Z</code> will be treated as
440     being a compressed English document (as will the document
441     <code>xxxx.Z.en</code>). Although the content language is
442     reported to the client, the browser is unlikely to use this
443     information. The <directive>AddLanguage</directive> directive is
444     more useful for <a href="../content-negotiation.html">content
445     negotiation</a>, where the server returns one from several documents
446     based on the client's language preference.</p>
448     <p>If multiple language assignments are made for the same
449     extension, the last one encountered is the one that is used.
450     That is, for the case of:</p>
452     <example>
453       AddLanguage en .en<br />
454       AddLanguage en-gb .en<br />
455       AddLanguage en-us .en
456     </example>
458     <p>documents with the extension <code>.en</code> would be treated as
459     being <code>en-us</code>.</p>
461     <p>The <var>extension</var> argument is case-insensitive and can
462     be specified with or without a leading dot. Filenames may have <a
463     href="#multipleext">multiple extensions</a> and the
464     <var>extension</var> argument will be compared against each of
465     them.</p>
466 </usage>
467 <seealso><module>mod_negotiation</module></seealso>
468 </directivesynopsis>
470 <directivesynopsis>
471 <name>AddOutputFilter</name>
472 <description>Maps filename extensions to the filters that will process
473 responses from the server</description>
474 <syntax>AddOutputFilter <var>filter</var>[;<var>filter</var>...]
475 <var>extension</var> [<var>extension</var>] ...</syntax>
476 <contextlist><context>server config</context><context>virtual host</context>
477 <context>directory</context><context>.htaccess</context></contextlist>
478 <override>FileInfo</override>
479 <compatibility>AddOutputFilter is only available in Apache 2.0.26 and
480 later.</compatibility>
482 <usage>
483     <p>The <directive>AddOutputFilter</directive> directive maps the
484     filename extension <var>extension</var> to the <a
485     href="../filter.html">filters</a> which will process responses
486     from the server before they are sent to the client. This is in
487     addition to any filters defined elsewhere, including <directive
488     module="core">SetOutputFilter</directive> and <directive module="core"
489     >AddOutputFilterByType</directive> 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>
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 <module>mod_deflate</module>.</p>
497     <example>
498       AddOutputFilter INCLUDES;DEFLATE shtml
499     </example>
501     <p>If more than one filter is specified, they must be separated
502     by semicolons in the order in which they should process the
503     content. The <var>filter</var> argument is case-insensitive.</p>
505     <p>The <var>extension</var> argument is case-insensitive and can
506     be specified with or without a leading dot. Filenames may have <a
507     href="#multipleext">multiple extensions</a> and the
508     <var>extension</var> argument will be compared against each of
509     them.</p>
510 </usage>
511 <seealso><directive module="mod_mime">RemoveOutputFilter</directive></seealso>
512 <seealso><directive module="core">SetOutputFilter</directive></seealso>
513 </directivesynopsis>
515 <directivesynopsis>
516 <name>AddType</name>
517 <description>Maps the given filename extensions onto the specified content
518 type</description>
519 <syntax>AddType <var>media-type</var> <var>extension</var>
520 [<var>extension</var>] ...</syntax>
521 <contextlist><context>server config</context><context>virtual host</context>
522 <context>directory</context><context>.htaccess</context></contextlist>
523 <override>FileInfo</override>
525 <usage>
526     <p>The <directive>AddType</directive> directive maps the given
527     filename extensions onto the specified content
528     type. <var>media-type</var> is the <glossary ref="media-type">media
529     type</glossary> to use for filenames containing
530     <var>extension</var>. This mapping is added to any already in
531     force, overriding any mappings that already exist for the same
532     <var>extension</var>. This directive can be used to add mappings
533     not listed in the media types file (see the <directive
534     module="mod_mime">TypesConfig</directive> directive).</p>
535     
536     <example><title>Example</title>
537       AddType image/gif .gif
538     </example>
540     <p>Or, to specify multiple file extensions in one directive:</p>
542     <example><title>Example</title>
543       AddType image/jpeg jpeg jpg jpe
544     </example>
546     <note>
547       It is recommended that new media types be added using the
548       <directive>AddType</directive> directive rather than changing the 
549       <directive module="mod_mime">TypesConfig</directive> file.
550     </note>
552     <p>The <var>extension</var> argument is case-insensitive and can
553     be specified with or without a leading dot. Filenames may have <a
554     href="#multipleext">multiple extensions</a> and the
555     <var>extension</var> argument will be compared against each of
556     them.</p>
557 </usage>
558 <seealso><directive module="core">ForceType</directive></seealso>
559 </directivesynopsis>
561 <directivesynopsis>
562 <name>MultiviewsMatch</name>
563 <description>The types of files that will be included when searching for
564 a matching file with MultiViews</description>
565 <syntax>MultiviewsMatch Any|NegotiatedOnly|Filters|Handlers
566 [Handlers|Filters]</syntax>
567 <default>MultiviewsMatch NegotiatedOnly</default>
568 <contextlist><context>server config</context><context>virtual host</context>
569 <context>directory</context><context>.htaccess</context></contextlist>
570 <override>FileInfo</override>
571 <compatibility>Available in Apache 2.0.26 and later.</compatibility>
573 <usage>
574     <p><directive>MultiviewsMatch</directive> permits three different
575     behaviors for <a href="mod_negotiation.html">mod_negotiation</a>'s
576     Multiviews feature.  Multiviews allows a request for a file,
577     <em>e.g.</em> <code>index.html</code>, to match any negotiated
578     extensions following the base request, <em>e.g.</em>
579     <code>index.html.en</code>, <code>index.html.fr</code>, or
580     <code>index.html.gz</code>.</p>
582     <p>The <code>NegotiatedOnly</code> option provides that every extension
583     following the base name must correlate to a recognized
584     <module>mod_mime</module> extension for content negotation, <em>e.g.</em>
585     Charset, Content-Type, Language, or Encoding.  This is the strictest
586     implementation with the fewest unexpected side effects, and is the
587     default behavior.</p>
589     <p>To include extensions associated with Handlers and/or Filters,
590     set the <directive>MultiviewsMatch</directive> directive to either
591     <code>Handlers</code>, <code>Filters</code>, or both option keywords.
592     If all other factors are equal, the smallest file will be served,
593     <em>e.g.</em> in deciding between <code>index.html.cgi</code> of 500
594     bytes and <code>index.html.pl</code> of 1000 bytes, the <code>.cgi</code>
595     file would win in this example. Users of <code>.asis</code> files
596     might prefer to use the Handler option, if <code>.asis</code> files are
597     associated with the <code>asis-handler</code>.</p>
599     <p>You may finally allow <code>Any</code> extensions to match, even if
600     <module>mod_mime</module> doesn't recognize the extension. This was the
601     behavior in Apache 1.3, and can cause unpredicatable results, such as
602     serving .old or .bak files the webmaster never expected to be served.</p>
604     <p>For example, the following configuration will allow handlers
605     and filters to participate in Multviews, but will exclude unknown
606     files:</p>
608     <example>
609       MultiviewsMatch Handlers Filters
610     </example>
611 </usage>
612 <seealso><directive module="core">Options</directive></seealso>
613 <seealso><module>mod_negotiation</module></seealso>
614 </directivesynopsis>
616 <directivesynopsis>
617 <name>DefaultLanguage</name>
618 <description>Defines a default language-tag to be sent in the Content-Language
619 header field for all resources in the current context that have not been
620 assigned a language-tag by some other means.</description>
621 <syntax>DefaultLanguage <var>language-tag</var></syntax>
622 <contextlist><context>server config</context><context>virtual host</context>
623 <context>directory</context><context>.htaccess</context></contextlist>
624 <override>FileInfo</override>
626 <usage>
627     <p>The <directive>DefaultLanguage</directive> directive tells Apache
628     that all resources in the directive's scope (<em>e.g.</em>, all resources
629     covered by the current <directive module="core" type="section"
630     >Directory</directive> container) that don't have an explicit language
631     extension (such as <code>.fr</code> or <code>.de</code> as configured
632     by <directive module="mod_mime">AddLanguage</directive>) should be
633     assigned a Content-Language of <var>language-tag</var>. This allows
634     entire directory trees to be marked as containing Dutch content, for
635     instance, without having to rename each file. Note that unlike using
636     extensions to specify languages, <directive>DefaultLanguage</directive>
637     can only specify a single language.</p>
639     <p>If no <directive>DefaultLanguage</directive> directive is in force
640     and a file does not have any language extensions as configured
641     by <directive module="mod_mime">AddLanguage</directive>, then no
642     Content-Language header field will be generated.</p>
644     <example><title>Example</title>
645       DefaultLanguage en
646     </example>
647 </usage>
648 <seealso><module>mod_negotiation</module></seealso>
649 </directivesynopsis>
651 <directivesynopsis>
652 <name>ModMimeUsePathInfo</name>
653 <description>Tells <module>mod_mime</module> to treat <code>path_info</code>
654 components as part of the filename</description>
655 <syntax>ModMimeUsePathInfo On|Off</syntax>
656 <default>ModMimeUsePathInfo Off</default>
657 <contextlist><context>directory</context></contextlist>
658 <compatibility>Available in Apache 2.0.41 and later</compatibility>
660 <usage>
661     <p>The <directive>ModMimeUsePathInfo</directive> directive is used to
662     combine the filename with the <code>path_info</code> URL component to
663     apply <module>mod_mime</module>'s directives to the request. The default
664     value is <code>Off</code> - therefore, the <code>path_info</code>
665     component is ignored.</p>
667     <p>This directive is recommended when you have a virtual filesystem.</p>
669     <example><title>Example</title>
670       ModMimeUsePathInfo On
671     </example>
673     <p>If you have a request for <code>/bar/foo.shtml</code> where
674     <code>/bar</code> is a Location and <directive
675     >ModMimeUsePathInfo</directive> is <code>On</code>,
676     <module>mod_mime</module> will treat the incoming request as
677     <code>/bar/foo.shtml</code> and directives like <code>AddOutputFilter
678     INCLUDES .shtml</code> will add the <code>INCLUDES</code> filter to the
679     request. If <directive>ModMimeUsePathInfo</directive> is not set, the
680     <code>INCLUDES</code> filter will not be added.</p>
681 </usage>
682 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
683 </directivesynopsis>
685 <directivesynopsis>
686 <name>RemoveCharset</name>
687 <description>Removes any character set associations for a set of file
688 extensions</description>
689 <syntax>RemoveCharset <var>extension</var> [<var>extension</var>]
690 ...</syntax>
691 <contextlist><context>virtual host</context><context>directory</context>
692 <context>.htaccess</context></contextlist>
693 <override>FileInfo</override>
694 <compatibility>RemoveCharset is only available in Apache 2.0.24 and
695 later.</compatibility>
697 <usage>
698     <p>The <directive>RemoveCharset</directive> directive removes any
699     character set associations for files with the given extensions.
700     This allows <code>.htaccess</code> files in subdirectories to
701     undo any associations inherited from parent directories or the
702     server config files.</p>
704     <p>The <var>extension</var> argument is case-insensitive and can
705     be specified with or without a leading dot.</p>
707     <example><title>Example</title>
708       RemoveCharset .html .shtml
709     </example>
710 </usage>
711 </directivesynopsis>
713 <directivesynopsis>
714 <name>RemoveEncoding</name>
715 <description>Removes any content encoding associations for a set of file
716 extensions</description>
717 <syntax>RemoveEncoding <var>extension</var> [<var>extension</var>]
718 ...</syntax>
719 <contextlist><context>virtual host</context><context>directory</context>
720 <context>.htaccess</context></contextlist>
721 <override>FileInfo</override>
723 <usage>
724     <p>The <directive>RemoveEncoding</directive> directive removes any
725     encoding associations for files with the given extensions. This
726     allows <code>.htaccess</code> files in subdirectories to undo
727     any associations inherited from parent directories or the
728     server config files. An example of its use might be:</p>
730     <example><title>/foo/.htaccess:</title>
731       AddEncoding x-gzip .gz<br />
732       AddType text/plain .asc<br />
733       &lt;Files *.gz.asc&gt;<br />
734       <indent>
735         RemoveEncoding .gz<br />
736       </indent>
737       &lt;/Files&gt;
738     </example>
740     <p>This will cause <code>foo.gz</code> to be marked as being
741     encoded with the gzip method, but <code>foo.gz.asc</code> as an
742     unencoded plaintext file.</p>
744     <note><title>Note</title>
745       <p><directive>RemoveEncoding</directive> directives are processed
746       <em>after</em> any <directive module="mod_mime">AddEncoding</directive>
747       directives, so it is possible they may undo the effects of the latter
748       if both occur within the same directory configuration.</p>
749     </note>
751     <p>The <var>extension</var> argument is case-insensitive and can
752     be specified with or without a leading dot.</p>
753 </usage>
754 </directivesynopsis>
756 <directivesynopsis>
757 <name>RemoveHandler</name>
758 <description>Removes any handler associations for a set of file
759 extensions</description>
760 <syntax>RemoveHandler <var>extension</var> [<var>extension</var>]
761 ...</syntax>
762 <contextlist><context>virtual host</context><context>directory</context>
763 <context>.htaccess</context></contextlist>
764 <override>FileInfo</override>
766 <usage>
767     <p>The <directive>RemoveHandler</directive> directive removes any
768     handler associations for files with the given extensions. This allows
769     <code>.htaccess</code> files in subdirectories to undo any
770     associations inherited from parent directories or the server
771     config files. An example of its use might be:</p>
773     <example><title>/foo/.htaccess:</title>
774       AddHandler server-parsed .html
775     </example>
777     <example><title>/foo/bar/.htaccess:</title>
778       RemoveHandler .html
779     </example>
781     <p>This has the effect of returning <code>.html</code> files in
782     the <code>/foo/bar</code> directory to being treated as normal
783     files, rather than as candidates for parsing (see the <module
784     >mod_include</module> module).</p>
786     <p>The <var>extension</var> argument is case-insensitive and can
787     be specified with or without a leading dot.</p>
788 </usage>
789 </directivesynopsis>
791 <directivesynopsis>
792 <name>RemoveInputFilter</name>
793 <description>Removes any input filter associations for a set of file
794 extensions</description>
795 <syntax>RemoveInputFilter <var>extension</var> [<var>extension</var>]
796 ...</syntax>
797 <contextlist><context>virtual host</context><context>directory</context>
798 <context>.htaccess</context></contextlist>
799 <override>FileInfo</override>
800 <compatibility>RemoveInputFilter is only available in Apache 2.0.26 and
801 later.</compatibility>
803 <usage>   
804     <p>The <directive>RemoveInputFilter</directive> directive removes any
805     input <a href="../filter.html">filter</a> associations for files with
806     the given extensions.
807     This allows <code>.htaccess</code> files in subdirectories to
808     undo any associations inherited from parent directories or the
809     server config files.</p>
811     <p>The <var>extension</var> argument is case-insensitive and can
812     be specified with or without a leading dot.</p>
813 </usage>
814 <seealso><directive module="mod_mime">AddInputFilter</directive></seealso>
815 <seealso><directive module="core">SetInputFilter</directive></seealso>
816 </directivesynopsis>
818 <directivesynopsis>
819 <name>RemoveLanguage</name>
820 <description>Removes any language associations for a set of file
821 extensions</description>
822 <syntax>RemoveLanguage <var>extension</var> [<var>extension</var>]
823 ...</syntax>
824 <contextlist><context>virtual host</context><context>directory</context>
825 <context>.htaccess</context></contextlist>
826 <override>FileInfo</override>
827 <compatibility>RemoveLanguage is only available in Apache 2.0.24 and
828 later.</compatibility>
830 <usage>
831     <p>The <directive>RemoveLanguage</directive> directive removes any
832     language associations for files with the given extensions. This
833     allows <code>.htaccess</code> files in subdirectories to undo
834     any associations inherited from parent directories or the
835     server config files.</p>
837     <p>The <var>extension</var> argument is case-insensitive and can
838     be specified with or without a leading dot.</p>
839 </usage>
840 </directivesynopsis>
842 <directivesynopsis>
843 <name>RemoveOutputFilter</name>
844 <description>Removes any output filter associations for a set of file
845 extensions</description>
846 <syntax>RemoveOutputFilter <var>extension</var> [<var>extension</var>]
847 ...</syntax>
848 <contextlist><context>virtual host</context><context>directory</context>
849 <context>.htaccess</context></contextlist>
850 <override>FileInfo</override>
851 <compatibility>RemoveOutputFilter is only available in Apache 2.0.26 and
852 later.</compatibility>
854 <usage>    
855     <p>The <directive>RemoveOutputFilter</directive> directive removes any
856     output <a href="../filter.html">filter</a> associations for files with
857     the given extensions.
858     This allows <code>.htaccess</code> files in subdirectories to
859     undo any associations inherited from parent directories or the
860     server config files.</p>
862     <p>The <var>extension</var> argument is case-insensitive and can
863     be specified with or without a leading dot.</p>
865     <example><title>Example</title>
866       RemoveOutputFilter shtml
867     </example>
868 </usage>
869 <seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
870 </directivesynopsis>
872 <directivesynopsis>
873 <name>RemoveType</name>
874 <description>Removes any content type associations for a set of file
875 extensions</description>
876 <syntax>RemoveType <var>extension</var> [<var>extension</var>]
877 ...</syntax>
878 <contextlist><context>virtual host</context><context>directory</context>
879 <context>.htaccess</context></contextlist>
880 <override>FileInfo</override>
882 <usage>
883     <p>The <directive>RemoveType</directive> directive removes any
884     <glossary ref="media-type">media type</glossary> associations for files with
885     the given extensions. This allows <code>.htaccess</code> files in
886     subdirectories to undo any associations inherited from parent
887     directories or the server config files. An example of its use
888     might be:</p>
890     <example><title>/foo/.htaccess:</title>
891       RemoveType .cgi
892     </example>
894     <p>This will remove any special handling of <code>.cgi</code>
895     files in the <code>/foo/</code> directory and any beneath it,
896     causing responses containing those files to omit the HTTP
897     Content-Type header field.</p>
899     <note><title>Note</title>
900       <p><directive>RemoveType</directive> directives are processed
901       <em>after</em> any <directive module="mod_mime">AddType</directive>
902       directives, so it is possible they may undo the effects of the
903       latter if both occur within the same directory configuration.</p>
904     </note>
906     <p>The <var>extension</var> argument is case-insensitive and can
907     be specified with or without a leading dot.</p>
908 </usage>
909 </directivesynopsis>
911 <directivesynopsis>
912 <name>TypesConfig</name>
913 <description>The location of the <code>mime.types</code> file</description>
914 <syntax>TypesConfig <var>file-path</var></syntax>
915 <default>TypesConfig conf/mime.types</default>
916 <contextlist><context>server config</context></contextlist>
918 <usage>
919     <p>The <directive>TypesConfig</directive> directive sets the
920     location of the <glossary ref="media-type">media types</glossary>
921     configuration file. <var>File-path</var> is relative to the
922     <directive module="core">ServerRoot</directive>. This file sets
923     the default list of mappings from filename extensions to content
924     types. Most administrators use the provided
925     <code>mime.types</code> file, which associates common filename
926     extensions with the official list of IANA registered media types
927     maintained at <a href=
928     "http://www.iana.org/assignments/media-types/index.html"
929     >http://www.iana.org/assignments/media-types/index.html</a>
930     as well as a large number of unofficial types.  This
931     simplifies the <code>httpd.conf</code> file by providing the
932     majority of media-type definitions, and may be overridden by
933     <directive module="mod_mime">AddType</directive> directives as
934     needed. You should not edit the <code>mime.types</code> file,
935     because it may be replaced when you upgrade your server.</p>
937     <p>The file contains lines in the format of the arguments to
938     an <directive module="mod_mime">AddType</directive> directive:</p>
940     <example>
941       <var>media-type</var> [<var>extension</var>] ...
942     </example>
944     <p>The case of the extension does not matter. Blank lines, and lines
945     beginning with a hash character (<code>#</code>) are ignored.</p>
947     <note>
948       Please do <strong>not</strong> send requests to the Apache HTTP
949       Server Project to add any new entries in the distributed
950       <code>mime.types</code> file unless (1) they are already
951       registered with IANA, and (2) they use widely accepted,
952       non-conflicting filename extensions across platforms.
953       <code>category/x-subtype</code> requests will be automatically
954       rejected, as will any new two-letter extensions as they will
955       likely conflict later with the already crowded language and
956       character set namespace.
957     </note>
958 </usage>
959 <seealso><module>mod_mime_magic</module></seealso>
960 </directivesynopsis>
962 </modulesynopsis>