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