2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2002-2005 The Apache Software Foundation or its licensors, as
10 Licensed under the Apache License, Version 2.0 (the "License");
11 you may not use this file except in compliance with the License.
12 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 associate various bits of "meta
36 information" with files by their filename extensions. This
37 information relates the filename of the document to it's
38 mime-type, language, character set and encoding. This
39 information is sent to the browser, and participates in content
40 negotiation, so the user's preferences are respected when
41 choosing one of several possible files to serve. See
42 <module>mod_negotiation</module> for more information
43 about <a href="../content-negotiation.html">content negotiation</a>.</p>
45 <p>The directives <directive
46 module="mod_mime">AddCharset</directive>, <directive
47 module="mod_mime">AddEncoding</directive>, <directive
48 module="mod_mime">AddLanguage</directive> and <directive
49 module="mod_mime">AddType</directive> are all used to map file
50 extensions onto the meta-information for that file. Respectively
51 they set the character set, content-encoding, content-language,
52 and <glossary>MIME-type</glossary> (content-type) of documents. The directive <directive
53 module="mod_mime">TypesConfig</directive> is used to specify a
54 file which also maps extensions onto MIME types. </p>
56 <p>In addition, <module>mod_mime</module> may define the <a
57 href="../handler.html">handler</a> and <a
58 href="../filter.html">filters</a> that originate and process
59 content. The directives <directive
60 module="mod_mime">AddHandler</directive>, <directive
61 module="mod_mime">AddOutputFilter</directive>, and <directive
62 module="mod_mime">AddInputFilter</directive> control the modules
63 or scripts that serve the document. The <directive
64 module="mod_mime">MultiviewsMatch</directive> directive allows
65 <module>mod_negotiation</module> to consider these file extensions
66 to be included when testing Multiviews matches.</p>
68 <p>While <module>mod_mime</module> associates meta-information
69 with filename extensions, the <module>core</module> server
70 provides directives that are used to associate all the files in a
71 given container (<em>e.g.</em>, <directive type="section"
72 module="core">Location</directive>, <directive type="section"
73 module="core">Directory</directive>, or <directive type="section"
74 module="core">Files</directive>) with particular
75 meta-information. These directives include <directive
76 module="core">ForceType</directive>, <directive
77 module="core">SetHandler</directive>, <directive
78 module="core">SetInputFilter</directive>, and <directive
79 module="core">SetOutputFilter</directive>. The core directives
80 override any filename extension mappings defined in
81 <module>mod_mime</module>.</p>
83 <p>Note that changing the meta-information for a file does not
84 change the value of the <code>Last-Modified</code> header.
85 Thus, previously cached copies may still be used by a client or
86 proxy, with the previous headers. If you change the
87 meta-information (language, content type, character set or
88 encoding) you may need to 'touch' affected files (updating
89 their last modified date) to ensure that all visitors are
90 receive the corrected content headers.</p>
93 module="mod_mime_magic">MimeMagicFile</directive></seealso>
94 <seealso><directive module="core">AddDefaultCharset</directive></seealso>
95 <seealso><directive module="core">ForceType</directive></seealso>
96 <seealso><directive module="core">DefaultType</directive></seealso>
97 <seealso><directive module="core">SetHandler</directive></seealso>
98 <seealso><directive module="core">SetInputFilter</directive></seealso>
99 <seealso><directive module="core">SetOutputFilter</directive></seealso>
101 <section id="multipleext"><title>Files with Multiple Extensions</title>
102 <p>Files can have more than one extension, and the order of the
103 extensions is <em>normally</em> irrelevant. For example, if the
104 file <code>welcome.html.fr</code> maps onto content type
105 <code>text/html</code> and language French then the file
106 <code>welcome.fr.html</code> will map onto exactly the same
107 information. If more than one extension is given which maps onto
108 the same type of meta-information, then the one to the right will
109 be used, except for languages and content encodings. For example,
110 if <code>.gif</code> maps to the <glossary>MIME-type</glossary>
111 <code>image/gif</code> and <code>.html</code> maps to the
112 MIME-type <code>text/html</code>, then the file
113 <code>welcome.gif.html</code> will be associated with the
114 MIME-type <code>text/html</code>.</p>
116 <p><a href="#charset-lang">Languages</a> and <a href="#contentencoding"
117 >content encodings</a> are treated accumulative, because one can assign
118 more than one language or encoding to a particular resource. For example,
119 the file <code>welcome.html.en.de</code> will be delivered with
120 <code>Content-Language: en, de</code> and <code>Content-Type:
121 text/html</code>.</p>
123 <p>Care should be taken when a file with multiple extensions
124 gets associated with both a <glossary>MIME-type</glossary> and a handler. This will
125 usually result in the request being by the module associated
126 with the handler. For example, if the <code>.imap</code>
127 extension is mapped to the handler <code>imap-file</code> (from
128 <module>mod_imagemap</module>) and the <code>.html</code> extension is
129 mapped to the MIME-type <code>text/html</code>, then the file
130 <code>world.imap.html</code> will be associated with both the
131 <code>imap-file</code> handler and <code>text/html</code> MIME-type.
132 When it is processed, the <code>imap-file</code> handler will be used,
133 and so it will be treated as a <module>mod_imagemap</module> imagemap
137 <section id="contentencoding"><title>Content encoding</title>
138 <p>A file of a particular <glossary>MIME-type</glossary> can additionally be encoded a
139 particular way to simplify transmission over the Internet.
140 While this usually will refer to compression, such as
141 <code>gzip</code>, it can also refer to encryption, such a
142 <code>pgp</code> or to an encoding such as UUencoding, which is
143 designed for transmitting a binary file in an ASCII (text)
146 <p>The <a href="http://www.ietf.org/rfc/rfc2616.txt">HTTP/1.1
147 RFC</a>, section 14.11 puts it this way:</p>
149 <blockquote cite="http://www.ietf.org/rfc/rfc2616.txt">
150 <p>The Content-Encoding entity-header field is used as a modifier to
151 the media-type. When present, its value indicates what additional
152 content codings have been applied to the entity-body, and thus what
153 decoding mechanisms must be applied in order to obtain the media-type
154 referenced by the Content-Type header field. Content-Encoding is
155 primarily used to allow a document to be compressed without losing
156 the identity of its underlying media type.</p>
159 <p>By using more than one file extension (see <a
160 href="#multipleext">section above about multiple file
161 extensions</a>), you can indicate that a file is of a
162 particular <em>type</em>, and also has a particular
163 <em>encoding</em>. </p>
165 <p>For example, you may have a file which is a Microsoft Word
166 document, which is pkzipped to reduce its size. If the
167 <code>.doc</code> extension is associated with the Microsoft
168 Word file type, and the <code>.zip</code> extension is
169 associated with the pkzip file encoding, then the file
170 <code>Resume.doc.zip</code> would be known to be a pkzip'ed Word
173 <p>Apache sends a <code>Content-encoding</code> header with the
174 resource, in order to tell the client browser about the
177 <example>Content-encoding: pkzip</example>
180 <section id="charset-lang"><title>Character sets and languages</title>
181 <p>In addition to file type and the file encoding,
182 another important piece of information is what language a
183 particular document is in, and in what character set the file
184 should be displayed. For example, the document might be written
185 in the Vietnamese alphabet, or in Cyrillic, and should be
186 displayed as such. This information, also, is transmitted in
189 <p>The character set, language, encoding and mime type are all
190 used in the process of content negotiation (See
191 <module>mod_negotiation</module>) to determine
192 which document to give to the client, when there are
193 alternative documents in more than one character set, language,
194 encoding or mime type. All filename extensions associations
195 created with <directive module="mod_mime">AddCharset</directive>,
196 <directive module="mod_mime">AddEncoding</directive>, <directive
197 module="mod_mime">AddLanguage</directive> and <directive
198 module="mod_mime">AddType</directive> directives
199 (and extensions listed in the <directive module="mod_mime_magic"
200 >MimeMagicFile</directive>) participate in this select process.
201 Filename extensions that are only associated using the <directive
202 module="mod_mime">AddHandler</directive>, <directive module="mod_mime"
203 >AddInputFilter</directive> or <directive module="mod_mime"
204 >AddOutputFilter</directive> directives may be included or excluded
205 from matching by using the <directive module="mod_mime"
206 >MultiviewsMatch</directive> directive.</p>
208 <section id="charset"><title>Charset</title>
209 <p>To convey this further information, Apache optionally sends
210 a <code>Content-Language</code> header, to specify the language
211 that the document is in, and can append additional information
212 onto the <code>Content-Type</code> header to indicate the
213 particular character set that should be used to correctly
214 render the information.</p>
217 Content-Language: en, fr<br />
218 Content-Type: text/plain; charset=ISO-8859-1
221 <p>The language specification is the two-letter abbreviation
222 for the language. The <code>charset</code> is the name of the
223 particular character set which should be used.</p>
228 <name>AddCharset</name>
229 <description>Maps the given filename extensions to the specified content
230 charset</description>
231 <syntax>AddCharset <var>charset</var> <var>extension</var>
232 [<var>extension</var>] ...</syntax>
233 <contextlist><context>server config</context><context>virtual host</context>
234 <context>directory</context><context>.htaccess</context></contextlist>
235 <override>FileInfo</override>
238 <p>The <directive>AddCharset</directive> directive maps the given
239 filename extensions to the specified content charset. <var>charset</var>
240 is the <a href="http://www.iana.org/assignments/character-sets">MIME
241 charset parameter</a> of filenames containing
242 <var>extension</var>. This mapping is added to any already in force,
243 overriding any mappings that already exist for the same
244 <var>extension</var>.</p>
246 <example><title>Example</title>
247 AddLanguage ja .ja<br />
248 AddCharset EUC-JP .euc<br />
249 AddCharset ISO-2022-JP .jis<br />
250 AddCharset SHIFT_JIS .sjis
253 <p>Then the document <code>xxxx.ja.jis</code> will be treated
254 as being a Japanese document whose charset is <code>ISO-2022-JP</code>
255 (as will the document <code>xxxx.jis.ja</code>). The
256 <directive>AddCharset</directive> directive is useful for both to
257 inform the client about the character encoding of the document so that
258 the document can be interpreted and displayed appropriately, and for <a
259 href="../content-negotiation.html">content negotiation</a>,
260 where the server returns one from several documents based on
261 the client's charset preference.</p>
263 <p>The <var>extension</var> argument is case-insensitive, and can
264 be specified with or without a leading dot.</p>
266 <seealso><module>mod_negotiation</module></seealso>
267 <seealso><directive module="core">AddDefaultCharset</directive></seealso>
271 <name>AddEncoding</name>
272 <description>Maps the given filename extensions to the specified encoding
274 <syntax>AddEncoding <var>MIME-enc</var> <var>extension</var>
275 [<var>extension</var>] ...</syntax>
276 <contextlist><context>server config</context><context>virtual host</context>
277 <context>directory</context><context>.htaccess</context></contextlist>
278 <override>FileInfo</override>
281 <p>The <directive>AddEncoding</directive> directive maps the given
282 filename extensions to the specified encoding type. <var>MIME-enc</var>
283 is the MIME encoding to use for documents containing the
284 <var>extension</var>. This mapping is added to any already in force,
285 overriding any mappings that already exist for the same
286 <var>extension</var>.</p>
288 <example><title>Example</title>
289 AddEncoding x-gzip .gz<br />
290 AddEncoding x-compress .Z
293 <p>This will cause filenames containing the <code>.gz</code> extension
294 to be marked as encoded using the <code>x-gzip</code> encoding, and
295 filenames containing the <code>.Z</code> extension to be marked as
296 encoded with <code>x-compress</code>.</p>
298 <p>Old clients expect <code>x-gzip</code> and <code>x-compress</code>,
299 however the standard dictates that they're equivalent to
300 <code>gzip</code> and <code>compress</code> respectively. Apache does
301 content encoding comparisons by ignoring any leading <code>x-</code>.
302 When responding with an encoding Apache will use whatever form
303 (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the
304 client requested. If the client didn't specifically request a
305 particular form Apache will use the form given by the
306 <code>AddEncoding</code> directive. To make this long story
307 short, you should always use <code>x-gzip</code> and
308 <code>x-compress</code> for these two specific encodings. More
309 recent encodings, such as <code>deflate</code> should be
310 specified without the <code>x-</code>.</p>
312 <p>The <var>extension</var> argument is case-insensitive, and can
313 be specified with or without a leading dot.</p>
318 <name>AddHandler</name>
319 <description>Maps the filename extensions to the specified
320 handler</description>
321 <syntax>AddHandler <var>handler-name</var> <var>extension</var>
322 [<var>extension</var>] ...</syntax>
323 <contextlist><context>server config</context><context>virtual host</context>
324 <context>directory</context><context>.htaccess</context></contextlist>
325 <override>FileInfo</override>
328 <p>Files having the name <var>extension</var> will be served by the
329 specified <var><a href="../handler.html">handler-name</a></var>. This
330 mapping is added to any already in force, overriding any mappings that
331 already exist for the same <var>extension</var>. For example, to
332 activate CGI scripts with the file extension <code>.cgi</code>, you
336 AddHandler cgi-script .cgi
339 <p>Once that has been put into your httpd.conf file, any file containing
340 the <code>.cgi</code> extension will be treated as a CGI program.</p>
342 <p>The <var>extension</var> argument is case-insensitive, and can
343 be specified with or without a leading dot.</p>
345 <seealso><directive module="core">SetHandler</directive></seealso>
349 <name>AddInputFilter</name>
350 <description>Maps filename extensions to the filters that will process
351 client requests</description>
352 <syntax>AddInputFilter <var>filter</var>[;<var>filter</var>...]
353 <var>extension</var> [<var>extension</var>] ...</syntax>
354 <contextlist><context>server config</context><context>virtual host</context>
355 <context>directory</context><context>.htaccess</context></contextlist>
356 <override>FileInfo</override>
357 <compatibility>AddInputFilter is only available in Apache 2.0.26 and
358 later.</compatibility>
361 <p><directive>AddInputFilter</directive> maps the filename extension
362 <var>extension</var> to the <a href="../filter.html">filters</a> which
363 will process client requests and POST input when they are received by
364 the server. This is in addition to any filters defined elsewhere,
365 including the <directive module="core">SetInputFilter</directive>
366 directive. This mapping is merged over any already in force, overriding
367 any mappings that already exist for the same <var>extension</var>.</p>
369 <p>If more than one filter is specified, they must be separated
370 by semicolons in the order in which they should process the
371 content. Both the filter and <var>extension</var> arguments are
372 case-insensitive, and the extension may be specified with or
373 without a leading dot.</p>
375 <seealso><directive module="mod_mime">RemoveInputFilter</directive></seealso>
376 <seealso><directive module="core">SetInputFilter</directive></seealso>
380 <name>AddLanguage</name>
381 <description>Maps the given filename extension to the specified content
382 language</description>
383 <syntax>AddLanguage <var>MIME-lang</var> <var>extension</var>
384 [<var>extension</var>] ...</syntax>
385 <contextlist><context>server config</context><context>virtual host</context>
386 <context>directory</context><context>.htaccess</context></contextlist>
387 <override>FileInfo</override>
390 <p>The <directive>AddLanguage</directive> directive maps the given
391 filename extension to the specified content language.
392 <var>MIME-lang</var> is the MIME language of filenames containing
393 <var>extension</var>. This mapping is added to any already in force,
394 overriding any mappings that already exist for the same
395 <var>extension</var>.</p>
397 <example><title>Example</title>
398 AddEncoding x-compress .Z<br />
399 AddLanguage en .en<br />
403 <p>Then the document <code>xxxx.en.Z</code> will be treated as
404 being a compressed English document (as will the document
405 <code>xxxx.Z.en</code>). Although the content language is
406 reported to the client, the browser is unlikely to use this
407 information. The <directive>AddLanguage</directive> directive is
408 more useful for <a href="../content-negotiation.html">content
409 negotiation</a>, where the server returns one from several documents
410 based on the client's language preference.</p>
412 <p>If multiple language assignments are made for the same
413 extension, the last one encountered is the one that is used.
414 That is, for the case of:</p>
417 AddLanguage en .en<br />
418 AddLanguage en-gb .en<br />
419 AddLanguage en-us .en
422 <p>documents with the extension <code>.en</code> would be treated as
423 being <code>en-us</code>.</p>
425 <p>The <var>extension</var> argument is case-insensitive, and can
426 be specified with or without a leading dot.</p>
428 <seealso><module>mod_negotiation</module></seealso>
432 <name>AddOutputFilter</name>
433 <description>Maps filename extensions to the filters that will process
434 responses from the server</description>
435 <syntax>AddOutputFilter <var>filter</var>[;<var>filter</var>...]
436 <var>extension</var> [<var>extension</var>] ...</syntax>
437 <contextlist><context>server config</context><context>virtual host</context>
438 <context>directory</context><context>.htaccess</context></contextlist>
439 <override>FileInfo</override>
440 <compatibility>AddOutputFilter is only available in Apache 2.0.26 and
441 later.</compatibility>
444 <p>The <directive>AddOutputFilter</directive> directive maps the
445 filename extension <var>extension</var> to the <a
446 href="../filter.html">filters</a> which will process responses
447 from the server before they are sent to the client. This is in
448 addition to any filters defined elsewhere, including <directive
449 module="core">SetOutputFilter</directive> and <directive module="core"
450 >AddOutputFilterByType</directive> directive. This mapping is merged
451 over any already in force, overriding any mappings that already exist
452 for the same <var>extension</var>.</p>
454 <p>For example, the following configuration will process all
455 <code>.shtml</code> files for server-side includes and will then
456 compress the output using <module>mod_deflate</module>.</p>
459 AddOutputFilter INCLUDES;DEFLATE shtml
462 <p>If more than one filter is specified, they must be separated
463 by semicolons in the order in which they should process the
464 content. Both the <var>filter</var> and <var>extension</var> arguments
465 are case-insensitive, and the extension may be specified with or
466 without a leading dot.</p>
468 <seealso><directive module="mod_mime">RemoveOutputFilter</directive></seealso>
469 <seealso><directive module="core">SetOutputFilter</directive></seealso>
474 <description>Maps the given filename extensions onto the specified content
476 <syntax>AddType <var>MIME-type</var> <var>extension</var>
477 [<var>extension</var>] ...</syntax>
478 <contextlist><context>server config</context><context>virtual host</context>
479 <context>directory</context><context>.htaccess</context></contextlist>
480 <override>FileInfo</override>
483 <p>The <directive>AddType</directive> directive maps the given
484 filename extensions onto the specified content
485 type. <var>MIME-type</var> is the <glossary ref="mime-type">MIME
486 type</glossary> to use for filenames containing
487 <var>extension</var>. This mapping is added to any already in
488 force, overriding any mappings that already exist for the same
489 <var>extension</var>. This directive can be used to add mappings
490 not listed in the MIME types file (see the <directive
491 module="mod_mime">TypesConfig</directive> directive).</p>
493 <example><title>Example</title>
494 AddType image/gif .gif
498 It is recommended that new MIME types be added using the
499 <directive>AddType</directive> directive rather than changing the
500 <directive module="mod_mime">TypesConfig</directive> file.
503 <p>The <var>extension</var> argument is case-insensitive, and can
504 be specified with or without a leading dot.</p>
506 <seealso><directive module="core">DefaultType</directive></seealso>
507 <seealso><directive module="core">ForceType</directive></seealso>
511 <name>MultiviewsMatch</name>
512 <description>The types of files that will be included when searching for
513 a matching file with MultiViews</description>
514 <syntax>MultiviewsMatch Any|NegotiatedOnly|Filters|Handlers
515 [Handlers|Filters]</syntax>
516 <default>MultiviewsMatch NegotiatedOnly</default>
517 <contextlist><context>server config</context><context>virtual host</context>
518 <context>directory</context><context>.htaccess</context></contextlist>
519 <override>FileInfo</override>
520 <compatibility>Available in Apache 2.0.26 and later.</compatibility>
523 <p><directive>MultiviewsMatch</directive> permits three different
524 behaviors for <a href="mod_negotiation.html">mod_negotiation</a>'s
525 Multiviews feature. Multiviews allows a request for a file,
526 <em>e.g.</em> <code>index.html</code>, to match any negotiated
527 extensions following the base request, <em>e.g.</em>
528 <code>index.html.en</code>, <code>index.html.fr</code>, or
529 <code>index.html.gz</code>.</p>
531 <p>The <code>NegotiatedOnly</code> option provides that every extension
532 following the base name must correlate to a recognized
533 <module>mod_mime</module> extension for content negotation, <em>e.g.</em>
534 Charset, Content-Type, Language, or Encoding. This is the strictest
535 implementation with the fewest unexpected side effects, and is the
536 default behavior.</p>
538 <p>To include extensions associated with Handlers and/or Filters,
539 set the <directive>MultiviewsMatch</directive> directive to either
540 <code>Handlers</code>, <code>Filters</code>, or both option keywords.
541 If all other factors are equal, the smallest file will be served,
542 <em>e.g.</em> in deciding between <code>index.html.cgi</code> of 500
543 bytes and <code>index.html.pl</code> of 1000 bytes, the <code>.cgi</code>
544 file would win in this example. Users of <code>.asis</code> files
545 might prefer to use the Handler option, if <code>.asis</code> files are
546 associated with the <code>asis-handler</code>.</p>
548 <p>You may finally allow <code>Any</code> extensions to match, even if
549 <module>mod_mime</module> doesn't recognize the extension. This was the
550 behavior in Apache 1.3, and can cause unpredicatable results, such as
551 serving .old or .bak files the webmaster never expected to be served.</p>
553 <p>For example, the following configuration will allow handlers
554 and filters to participate in Multviews, but will exclude unknown
558 MultiviewsMatch Handlers Filters
561 <seealso><directive module="core">Options</directive></seealso>
562 <seealso><module>mod_negotiation</module></seealso>
566 <name>DefaultLanguage</name>
567 <description>Sets all files in the given scope to the specified
568 language</description>
569 <syntax>DefaultLanguage <var>MIME-lang</var></syntax>
570 <contextlist><context>server config</context><context>virtual host</context>
571 <context>directory</context><context>.htaccess</context></contextlist>
572 <override>FileInfo</override>
575 <p>The <directive>DefaultLanguage</directive> directive tells Apache
576 that all files in the directive's scope (<em>e.g.</em>, all files
577 covered by the current <directive module="core" type="section"
578 >Directory</directive> container) that don't have an explicit language
579 extension (such as <code>.fr</code> or <code>.de</code> as configured
580 by <directive module="mod_mime">AddLanguage</directive>) should be
581 considered to be in the specified <var>MIME-lang</var> language. This
582 allows entire directories to be marked as containing Dutch content, for
583 instance, without having to rename each file. Note that unlike using
584 extensions to specify languages, <directive>DefaultLanguage</directive>
585 can only specify a single language.</p>
587 <p>If no <directive>DefaultLanguage</directive> directive is in force,
588 and a file does not have any language extensions as configured
589 by <directive module="mod_mime">AddLanguage</directive>, then that file
590 will be considered to have no language attribute.</p>
592 <example><title>Example</title>
596 <seealso><module>mod_negotiation</module></seealso>
600 <name>ModMimeUsePathInfo</name>
601 <description>Tells <module>mod_mime</module> to treat <code>path_info</code>
602 components as part of the filename</description>
603 <syntax>ModMimeUsePathInfo On|Off</syntax>
604 <default>ModMimeUsePathInfo Off</default>
605 <contextlist><context>directory</context></contextlist>
606 <compatibility>Available in Apache 2.0.41 and later</compatibility>
609 <p>The <directive>ModMimeUsePathInfo</directive> directive is used to
610 combine the filename with the <code>path_info</code> URL component to
611 apply <module>mod_mime</module>'s directives to the request. The default
612 value is <code>Off</code> - therefore, the <code>path_info</code>
613 component is ignored.</p>
615 <p>This directive is recommended when you have a virtual filesystem.</p>
617 <example><title>Example</title>
618 ModMimeUsePathInfo On
621 <p>If you have a request for <code>/bar/foo.shtml</code> where
622 <code>/bar</code> is a Location and <directive
623 >ModMimeUsePathInfo</directive> is <code>On</code>,
624 <module>mod_mime</module> will treat the incoming request as
625 <code>/bar/foo.shtml</code> and directives like <code>AddOutputFilter
626 INCLUDES .shtml</code> will add the <code>INCLUDES</code> filter to the
627 request. If <directive>ModMimeUsePathInfo</directive> is not set, the
628 <code>INCLUDES</code> filter will not be added.</p>
630 <seealso><directive module="core">AcceptPathInfo</directive></seealso>
634 <name>RemoveCharset</name>
635 <description>Removes any character set associations for a set of file
636 extensions</description>
637 <syntax>RemoveCharset <var>extension</var> [<var>extension</var>]
639 <contextlist><context>virtual host</context><context>directory</context>
640 <context>.htaccess</context></contextlist>
641 <override>FileInfo</override>
642 <compatibility>RemoveCharset is only available in Apache 2.0.24 and
643 later.</compatibility>
646 <p>The <directive>RemoveCharset</directive> directive removes any
647 character set associations for files with the given extensions.
648 This allows <code>.htaccess</code> files in subdirectories to
649 undo any associations inherited from parent directories or the
650 server config files.</p>
652 <p>The <var>extension</var> argument is case-insensitive, and can
653 be specified with or without a leading dot.</p>
655 <example><title>Example</title>
656 RemoveCharset .html .shtml
662 <name>RemoveEncoding</name>
663 <description>Removes any content encoding associations for a set of file
664 extensions</description>
665 <syntax>RemoveEncoding <var>extension</var> [<var>extension</var>]
667 <contextlist><context>virtual host</context><context>directory</context>
668 <context>.htaccess</context></contextlist>
669 <override>FileInfo</override>
672 <p>The <directive>RemoveEncoding</directive> directive removes any
673 encoding associations for files with the given extensions. This
674 allows <code>.htaccess</code> files in subdirectories to undo
675 any associations inherited from parent directories or the
676 server config files. An example of its use might be:</p>
678 <example><title>/foo/.htaccess:</title>
679 AddEncoding x-gzip .gz<br />
680 AddType text/plain .asc<br />
681 <Files *.gz.asc><br />
683 RemoveEncoding .gz<br />
688 <p>This will cause <code>foo.gz</code> to be marked as being
689 encoded with the gzip method, but <code>foo.gz.asc</code> as an
690 unencoded plaintext file.</p>
692 <note><title>Note</title>
693 <p><directive>RemoveEncoding</directive> directives are processed
694 <em>after</em> any <directive module="mod_mime">AddEncoding</directive>
695 directives, so it is possible they may undo the effects of the latter
696 if both occur within the same directory configuration.</p>
699 <p>The <var>extension</var> argument is case-insensitive, and can
700 be specified with or without a leading dot.</p>
705 <name>RemoveHandler</name>
706 <description>Removes any handler associations for a set of file
707 extensions</description>
708 <syntax>RemoveHandler <var>extension</var> [<var>extension</var>]
710 <contextlist><context>virtual host</context><context>directory</context>
711 <context>.htaccess</context></contextlist>
712 <override>FileInfo</override>
715 <p>The <directive>RemoveHandler</directive> directive removes any
716 handler associations for files with the given extensions. This allows
717 <code>.htaccess</code> files in subdirectories to undo any
718 associations inherited from parent directories or the server
719 config files. An example of its use might be:</p>
721 <example><title>/foo/.htaccess:</title>
722 AddHandler server-parsed .html
725 <example><title>/foo/bar/.htaccess:</title>
729 <p>This has the effect of returning <code>.html</code> files in
730 the <code>/foo/bar</code> directory to being treated as normal
731 files, rather than as candidates for parsing (see the <module
732 >mod_include</module> module).</p>
734 <p>The <var>extension</var> argument is case-insensitive, and can
735 be specified with or without a leading dot.</p>
740 <name>RemoveInputFilter</name>
741 <description>Removes any input filter associations for a set of file
742 extensions</description>
743 <syntax>RemoveInputFilter <var>extension</var> [<var>extension</var>]
745 <contextlist><context>virtual host</context><context>directory</context>
746 <context>.htaccess</context></contextlist>
747 <override>FileInfo</override>
748 <compatibility>RemoveInputFilter is only available in Apache 2.0.26 and
749 later.</compatibility>
752 <p>The <directive>RemoveInputFilter</directive> directive removes any
753 input filter associations for files with the given extensions.
754 This allows <code>.htaccess</code> files in subdirectories to
755 undo any associations inherited from parent directories or the
756 server config files.</p>
758 <p>The <var>extension</var> argument is case-insensitive, and can
759 be specified with or without a leading dot.</p>
761 <seealso><directive module="mod_mime">AddInputFilter</directive></seealso>
762 <seealso><directive module="core">SetInputFilter</directive></seealso>
766 <name>RemoveLanguage</name>
767 <description>Removes any language associations for a set of file
768 extensions</description>
769 <syntax>RemoveLanguage <var>extension</var> [<var>extension</var>]
771 <contextlist><context>virtual host</context><context>directory</context>
772 <context>.htaccess</context></contextlist>
773 <override>FileInfo</override>
774 <compatibility>RemoveLanguage is only available in Apache 2.0.24 and
775 later.</compatibility>
778 <p>The <directive>RemoveLanguage</directive> directive removes any
779 language associations for files with the given extensions. This
780 allows <code>.htaccess</code> files in subdirectories to undo
781 any associations inherited from parent directories or the
782 server config files.</p>
784 <p>The <var>extension</var> argument is case-insensitive, and can
785 be specified with or without a leading dot.</p>
790 <name>RemoveOutputFilter</name>
791 <description>Removes any output filter associations for a set of file
792 extensions</description>
793 <syntax>RemoveOutputFilter <var>extension</var> [<var>extension</var>]
795 <contextlist><context>virtual host</context><context>directory</context>
796 <context>.htaccess</context></contextlist>
797 <override>FileInfo</override>
798 <compatibility>RemoveOutputFilter is only available in Apache 2.0.26 and
799 later.</compatibility>
802 <p>The <directive>RemoveOutputFilter</directive> directive removes any
803 output filter associations for files with the given extensions.
804 This allows <code>.htaccess</code> files in subdirectories to
805 undo any associations inherited from parent directories or the
806 server config files.</p>
808 <p>The <var>extension</var> argument is case-insensitive, and can
809 be specified with or without a leading dot.</p>
811 <example><title>Example</title>
812 RemoveOutputFilter shtml
815 <seealso><directive module="mod_mime">AddOutputFilter</directive></seealso>
819 <name>RemoveType</name>
820 <description>Removes any content type associations for a set of file
821 extensions</description>
822 <syntax>RemoveType <var>extension</var> [<var>extension</var>]
824 <contextlist><context>virtual host</context><context>directory</context>
825 <context>.htaccess</context></contextlist>
826 <override>FileInfo</override>
829 <p>The <directive>RemoveType</directive> directive removes any
830 <glossary ref="mime-type">MIME type</glossary> associations for files with
831 the given extensions. This allows <code>.htaccess</code> files in
832 subdirectories to undo any associations inherited from parent
833 directories or the server config files. An example of its use
836 <example><title>/foo/.htaccess:</title>
840 <p>This will remove any special handling of <code>.cgi</code>
841 files in the <code>/foo/</code> directory and any beneath it,
842 causing the files to be treated as being of the <directive
843 module="core">DefaultType</directive>.</p>
845 <note><title>Note</title>
846 <p><directive>RemoveType</directive> directives are processed
847 <em>after</em> any <directive module="mod_mime">AddType</directive>
848 directives, so it is possible they may undo the effects of the
849 latter if both occur within the same directory configuration.</p>
852 <p>The <var>extension</var> argument is case-insensitive, and can
853 be specified with or without a leading dot.</p>
858 <name>TypesConfig</name>
859 <description>The location of the <code>mime.types</code> file</description>
860 <syntax>TypesConfig <var>file-path</var></syntax>
861 <default>TypesConfig conf/mime.types</default>
862 <contextlist><context>server config</context></contextlist>
865 <p>The <directive>TypesConfig</directive> directive sets the
866 location of the <glossary ref="mime-type">MIME types</glossary>
867 configuration file. <var>File-path</var> is relative to the
868 <directive module="core">ServerRoot</directive>. This file sets
869 the default list of mappings from filename extensions to content
870 types. Most administrators use the provided
871 <code>mime.types</code> file, which associates common filename
872 extensions with IANA registered content types. The current list is
873 maintained at <a href=
874 "http://www.iana.org/assignments/media-types/index.html"
875 >http://www.iana.org/assignments/media-types/index.html</a>. This
876 simplifies the <code>httpd.conf</code> file by providing the
877 majority of media-type definitions, and may be overridden by
878 <directive module="mod_mime">AddType</directive> directives as
879 needed. You should not edit the <code>mime.types</code> file,
880 because it may be replaced when you upgrade your server.</p>
882 <p>The file contains lines in the format of the arguments to
883 an <directive module="mod_mime">AddType</directive> directive:</p>
886 <var>MIME-type</var> [<var>extension</var>] ...
889 <p>The case of the extension does not matter. Blank lines, and lines
890 beginning with a hash character (<code>#</code>) are ignored.</p>
893 Please do <strong>not</strong> send requests to the Apache HTTP
894 Server Project to add any new entries in the distributed
895 <code>mime.types</code> file unless (1) they are already
896 registered with IANA, and (2) they use widely accepted,
897 non-conflicting filename extensions across platforms.
898 <code>category/x-subtype</code> requests will be automatically
899 rejected, as will any new two-letter extensions as they will
900 likely conflict later with the already crowded language and
901 character set namespace.
904 <seealso><module>mod_mime_magic</module></seealso>