2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
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.
23 <modulesynopsis metafile="mod_mime.xml.meta">
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>
31 <sourcefile>mod_mime.c</sourcefile>
32 <identifier>mime_module</identifier>
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>
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
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 <FilesMatch \.cgi$>
148 SetHandler cgi-script
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)
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>
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
191 <p>Apache sends a <code>Content-encoding</code> header with the
192 resource, in order to tell the client browser about the
195 <example>Content-encoding: pkzip</example>
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
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>
235 Content-Language: en, fr<br />
236 Content-Type: text/plain; charset=ISO-8859-1
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>
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>
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
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
289 <seealso><module>mod_negotiation</module></seealso>
290 <seealso><directive module="core">AddDefaultCharset</directive></seealso>
294 <name>AddEncoding</name>
295 <description>Maps the given filename extensions to the specified encoding
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>
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
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
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>
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
363 AddHandler cgi-script .cgi
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
375 <seealso><directive module="core">SetHandler</directive></seealso>
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>
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
410 <seealso><directive module="mod_mime">RemoveInputFilter</directive></seealso>
411 <seealso><directive module="core">SetInputFilter</directive></seealso>
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>
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 />
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>
453 AddLanguage en .en<br />
454 AddLanguage en-gb .en<br />
455 AddLanguage en-us .en
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
467 <seealso><module>mod_negotiation</module></seealso>
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>
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>
498 AddOutputFilter INCLUDES;DEFLATE shtml
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
511 <seealso><directive module="mod_mime">RemoveOutputFilter</directive></seealso>
512 <seealso><directive module="core">SetOutputFilter</directive></seealso>
517 <description>Maps the given filename extensions onto the specified content
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>
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>
536 <example><title>Example</title>
537 AddType image/gif .gif
540 <p>Or, to specify multiple file extensions in one directive:</p>
542 <example><title>Example</title>
543 AddType image/jpeg jpeg jpg jpe
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.
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
558 <seealso><directive module="core">ForceType</directive></seealso>
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>
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
609 MultiviewsMatch Handlers Filters
612 <p><directive>MultiviewsMatch</directive> is not allowed in a
613 <directive type="section" module="core">Location</directive> or <directive
614 type="section" module="core">LocationMatch</directive> section.</p>
617 <seealso><directive module="core">Options</directive></seealso>
618 <seealso><module>mod_negotiation</module></seealso>
622 <name>DefaultLanguage</name>
623 <description>Defines a default language-tag to be sent in the Content-Language
624 header field for all resources in the current context that have not been
625 assigned a language-tag by some other means.</description>
626 <syntax>DefaultLanguage <var>language-tag</var></syntax>
627 <contextlist><context>server config</context><context>virtual host</context>
628 <context>directory</context><context>.htaccess</context></contextlist>
629 <override>FileInfo</override>
632 <p>The <directive>DefaultLanguage</directive> directive tells Apache
633 that all resources in the directive's scope (<em>e.g.</em>, all resources
634 covered by the current <directive module="core" type="section"
635 >Directory</directive> container) that don't have an explicit language
636 extension (such as <code>.fr</code> or <code>.de</code> as configured
637 by <directive module="mod_mime">AddLanguage</directive>) should be
638 assigned a Content-Language of <var>language-tag</var>. This allows
639 entire directory trees to be marked as containing Dutch content, for
640 instance, without having to rename each file. Note that unlike using
641 extensions to specify languages, <directive>DefaultLanguage</directive>
642 can only specify a single language.</p>
644 <p>If no <directive>DefaultLanguage</directive> directive is in force
645 and a file does not have any language extensions as configured
646 by <directive module="mod_mime">AddLanguage</directive>, then no
647 Content-Language header field will be generated.</p>
649 <example><title>Example</title>
653 <seealso><module>mod_negotiation</module></seealso>
657 <name>ModMimeUsePathInfo</name>
658 <description>Tells <module>mod_mime</module> to treat <code>path_info</code>
659 components as part of the filename</description>
660 <syntax>ModMimeUsePathInfo On|Off</syntax>
661 <default>ModMimeUsePathInfo Off</default>
662 <contextlist><context>directory</context></contextlist>
663 <compatibility>Available in Apache 2.0.41 and later</compatibility>
666 <p>The <directive>ModMimeUsePathInfo</directive> directive is used to
667 combine the filename with the <code>path_info</code> URL component to
668 apply <module>mod_mime</module>'s directives to the request. The default
669 value is <code>Off</code> - therefore, the <code>path_info</code>
670 component is ignored.</p>
672 <p>This directive is recommended when you have a virtual filesystem.</p>
674 <example><title>Example</title>
675 ModMimeUsePathInfo On
678 <p>If you have a request for <code>/bar/foo.shtml</code> where
679 <code>/bar</code> is a Location and <directive
680 >ModMimeUsePathInfo</directive> is <code>On</code>,
681 <module>mod_mime</module> will treat the incoming request as
682 <code>/bar/foo.shtml</code> and directives like <code>AddOutputFilter
683 INCLUDES .shtml</code> will add the <code>INCLUDES</code> filter to the
684 request. If <directive>ModMimeUsePathInfo</directive> is not set, the
685 <code>INCLUDES</code> filter will not be added.</p>
687 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
691 <name>RemoveCharset</name>
692 <description>Removes any character set associations for a set of file
693 extensions</description>
694 <syntax>RemoveCharset <var>extension</var> [<var>extension</var>]
696 <contextlist><context>virtual host</context><context>directory</context>
697 <context>.htaccess</context></contextlist>
698 <override>FileInfo</override>
699 <compatibility>RemoveCharset is only available in Apache 2.0.24 and
700 later.</compatibility>
703 <p>The <directive>RemoveCharset</directive> directive removes any
704 character set associations for files with the given extensions.
705 This allows <code>.htaccess</code> files in subdirectories to
706 undo any associations inherited from parent directories or the
707 server config files.</p>
709 <p>The <var>extension</var> argument is case-insensitive and can
710 be specified with or without a leading dot.</p>
712 <example><title>Example</title>
713 RemoveCharset .html .shtml
719 <name>RemoveEncoding</name>
720 <description>Removes any content encoding associations for a set of file
721 extensions</description>
722 <syntax>RemoveEncoding <var>extension</var> [<var>extension</var>]
724 <contextlist><context>virtual host</context><context>directory</context>
725 <context>.htaccess</context></contextlist>
726 <override>FileInfo</override>
729 <p>The <directive>RemoveEncoding</directive> directive removes any
730 encoding associations for files with the given extensions. This
731 allows <code>.htaccess</code> files in subdirectories to undo
732 any associations inherited from parent directories or the
733 server config files. An example of its use might be:</p>
735 <example><title>/foo/.htaccess:</title>
736 AddEncoding x-gzip .gz<br />
737 AddType text/plain .asc<br />
738 <Files *.gz.asc><br />
740 RemoveEncoding .gz<br />
745 <p>This will cause <code>foo.gz</code> to be marked as being
746 encoded with the gzip method, but <code>foo.gz.asc</code> as an
747 unencoded plaintext file.</p>
749 <note><title>Note</title>
750 <p><directive>RemoveEncoding</directive> directives are processed
751 <em>after</em> any <directive module="mod_mime">AddEncoding</directive>
752 directives, so it is possible they may undo the effects of the latter
753 if both occur within the same directory configuration.</p>
756 <p>The <var>extension</var> argument is case-insensitive and can
757 be specified with or without a leading dot.</p>
762 <name>RemoveHandler</name>
763 <description>Removes any handler associations for a set of file
764 extensions</description>
765 <syntax>RemoveHandler <var>extension</var> [<var>extension</var>]
767 <contextlist><context>virtual host</context><context>directory</context>
768 <context>.htaccess</context></contextlist>
769 <override>FileInfo</override>
772 <p>The <directive>RemoveHandler</directive> directive removes any
773 handler associations for files with the given extensions. This allows
774 <code>.htaccess</code> files in subdirectories to undo any
775 associations inherited from parent directories or the server
776 config files. An example of its use might be:</p>
778 <example><title>/foo/.htaccess:</title>
779 AddHandler server-parsed .html
782 <example><title>/foo/bar/.htaccess:</title>
786 <p>This has the effect of returning <code>.html</code> files in
787 the <code>/foo/bar</code> directory to being treated as normal
788 files, rather than as candidates for parsing (see the <module
789 >mod_include</module> module).</p>
791 <p>The <var>extension</var> argument is case-insensitive and can
792 be specified with or without a leading dot.</p>
797 <name>RemoveInputFilter</name>
798 <description>Removes any input filter associations for a set of file
799 extensions</description>
800 <syntax>RemoveInputFilter <var>extension</var> [<var>extension</var>]
802 <contextlist><context>virtual host</context><context>directory</context>
803 <context>.htaccess</context></contextlist>
804 <override>FileInfo</override>
805 <compatibility>RemoveInputFilter is only available in Apache 2.0.26 and
806 later.</compatibility>
809 <p>The <directive>RemoveInputFilter</directive> directive removes any
810 input <a href="../filter.html">filter</a> associations for files with
811 the given extensions.
812 This allows <code>.htaccess</code> files in subdirectories to
813 undo any associations inherited from parent directories or the
814 server config files.</p>
816 <p>The <var>extension</var> argument is case-insensitive and can
817 be specified with or without a leading dot.</p>
819 <seealso><directive module="mod_mime">AddInputFilter</directive></seealso>
820 <seealso><directive module="core">SetInputFilter</directive></seealso>
824 <name>RemoveLanguage</name>
825 <description>Removes any language associations for a set of file
826 extensions</description>
827 <syntax>RemoveLanguage <var>extension</var> [<var>extension</var>]
829 <contextlist><context>virtual host</context><context>directory</context>
830 <context>.htaccess</context></contextlist>
831 <override>FileInfo</override>
832 <compatibility>RemoveLanguage is only available in Apache 2.0.24 and
833 later.</compatibility>
836 <p>The <directive>RemoveLanguage</directive> directive removes any
837 language associations for files with the given extensions. This
838 allows <code>.htaccess</code> files in subdirectories to undo
839 any associations inherited from parent directories or the
840 server config files.</p>
842 <p>The <var>extension</var> argument is case-insensitive and can
843 be specified with or without a leading dot.</p>
848 <name>RemoveOutputFilter</name>
849 <description>Removes any output filter associations for a set of file
850 extensions</description>
851 <syntax>RemoveOutputFilter <var>extension</var> [<var>extension</var>]
853 <contextlist><context>virtual host</context><context>directory</context>
854 <context>.htaccess</context></contextlist>
855 <override>FileInfo</override>
856 <compatibility>RemoveOutputFilter is only available in Apache 2.0.26 and
857 later.</compatibility>
860 <p>The <directive>RemoveOutputFilter</directive> directive removes any
861 output <a href="../filter.html">filter</a> associations for files with
862 the given extensions.
863 This allows <code>.htaccess</code> files in subdirectories to
864 undo any associations inherited from parent directories or the
865 server config files.</p>
867 <p>The <var>extension</var> argument is case-insensitive and can
868 be specified with or without a leading dot.</p>
870 <example><title>Example</title>
871 RemoveOutputFilter shtml
874 <seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
878 <name>RemoveType</name>
879 <description>Removes any content type associations for a set of file
880 extensions</description>
881 <syntax>RemoveType <var>extension</var> [<var>extension</var>]
883 <contextlist><context>virtual host</context><context>directory</context>
884 <context>.htaccess</context></contextlist>
885 <override>FileInfo</override>
888 <p>The <directive>RemoveType</directive> directive removes any
889 <glossary ref="media-type">media type</glossary> associations for files with
890 the given extensions. This allows <code>.htaccess</code> files in
891 subdirectories to undo any associations inherited from parent
892 directories or the server config files. An example of its use
895 <example><title>/foo/.htaccess:</title>
899 <p>This will remove any special handling of <code>.cgi</code>
900 files in the <code>/foo/</code> directory and any beneath it,
901 causing responses containing those files to omit the HTTP
902 Content-Type header field.</p>
904 <note><title>Note</title>
905 <p><directive>RemoveType</directive> directives are processed
906 <em>after</em> any <directive module="mod_mime">AddType</directive>
907 directives, so it is possible they may undo the effects of the
908 latter if both occur within the same directory configuration.</p>
911 <p>The <var>extension</var> argument is case-insensitive and can
912 be specified with or without a leading dot.</p>
917 <name>TypesConfig</name>
918 <description>The location of the <code>mime.types</code> file</description>
919 <syntax>TypesConfig <var>file-path</var></syntax>
920 <default>TypesConfig conf/mime.types</default>
921 <contextlist><context>server config</context></contextlist>
924 <p>The <directive>TypesConfig</directive> directive sets the
925 location of the <glossary ref="media-type">media types</glossary>
926 configuration file. <var>File-path</var> is relative to the
927 <directive module="core">ServerRoot</directive>. This file sets
928 the default list of mappings from filename extensions to content
929 types. Most administrators use the provided
930 <code>mime.types</code> file, which associates common filename
931 extensions with the official list of IANA registered media types
932 maintained at <a href=
933 "http://www.iana.org/assignments/media-types/index.html"
934 >http://www.iana.org/assignments/media-types/index.html</a>
935 as well as a large number of unofficial types. This
936 simplifies the <code>httpd.conf</code> file by providing the
937 majority of media-type definitions, and may be overridden by
938 <directive module="mod_mime">AddType</directive> directives as
939 needed. You should not edit the <code>mime.types</code> file,
940 because it may be replaced when you upgrade your server.</p>
942 <p>The file contains lines in the format of the arguments to
943 an <directive module="mod_mime">AddType</directive> directive:</p>
946 <var>media-type</var> [<var>extension</var>] ...
949 <p>The case of the extension does not matter. Blank lines, and lines
950 beginning with a hash character (<code>#</code>) are ignored.</p>
953 Please do <strong>not</strong> send requests to the Apache HTTP
954 Server Project to add any new entries in the distributed
955 <code>mime.types</code> file unless (1) they are already
956 registered with IANA, and (2) they use widely accepted,
957 non-conflicting filename extensions across platforms.
958 <code>category/x-subtype</code> requests will be automatically
959 rejected, as will any new two-letter extensions as they will
960 likely conflict later with the already crowded language and
961 character set namespace.
964 <seealso><module>mod_mime_magic</module></seealso>