📄 mod_mime.html.en
字号:
<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr></table> <p>The <code class="directive">AddCharset</code> directive maps the given filename extensions to the specified content charset. <var>charset</var> is the <a href="http://www.iana.org/assignments/character-sets">MIME charset parameter</a> of filenames containing <var>extension</var>. This mapping is added to any already in force, overriding any mappings that already exist for the same <var>extension</var>.</p> <div class="example"><h3>Example</h3><p><code> AddLanguage ja .ja<br /> AddCharset EUC-JP .euc<br /> AddCharset ISO-2022-JP .jis<br /> AddCharset SHIFT_JIS .sjis </code></p></div> <p>Then the document <code>xxxx.ja.jis</code> will be treated as being a Japanese document whose charset is <code>ISO-2022-JP</code> (as will the document <code>xxxx.jis.ja</code>). The <code class="directive">AddCharset</code> directive is useful for both to inform the client about the character encoding of the document so that the document can be interpreted and displayed appropriately, and for <a href="../content-negotiation.html">content negotiation</a>, where the server returns one from several documents based on the client's charset preference.</p> <p>The <var>extension</var> argument is case-insensitive, and can be specified with or without a leading dot.</p><h3>See also</h3><ul><li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li><li><code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddEncoding" id="AddEncoding">AddEncoding</a> <a name="addencoding" id="addencoding">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extensions to the specified encodingtype</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddEncoding <var>MIME-enc</var> <var>extension</var>[<var>extension</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr></table> <p>The <code class="directive">AddEncoding</code> directive maps the given filename extensions to the specified encoding type. <var>MIME-enc</var> is the MIME encoding to use for documents containing the <var>extension</var>. This mapping is added to any already in force, overriding any mappings that already exist for the same <var>extension</var>.</p> <div class="example"><h3>Example</h3><p><code> AddEncoding x-gzip .gz<br /> AddEncoding x-compress .Z </code></p></div> <p>This will cause filenames containing the <code>.gz</code> extension to be marked as encoded using the <code>x-gzip</code> encoding, and filenames containing the <code>.Z</code> extension to be marked as encoded with <code>x-compress</code>.</p> <p>Old clients expect <code>x-gzip</code> and <code>x-compress</code>, however the standard dictates that they're equivalent to <code>gzip</code> and <code>compress</code> respectively. Apache does content encoding comparisons by ignoring any leading <code>x-</code>. When responding with an encoding Apache will use whatever form (<em>i.e.</em>, <code>x-foo</code> or <code>foo</code>) the client requested. If the client didn't specifically request a particular form Apache will use the form given by the <code>AddEncoding</code> directive. To make this long story short, you should always use <code>x-gzip</code> and <code>x-compress</code> for these two specific encodings. More recent encodings, such as <code>deflate</code> should be specified without the <code>x-</code>.</p> <p>The <var>extension</var> argument is case-insensitive, and can be specified with or without a leading dot.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddHandler" id="AddHandler">AddHandler</a> <a name="addhandler" id="addhandler">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the filename extensions to the specifiedhandler</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddHandler <var>handler-name</var> <var>extension</var>[<var>extension</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr></table> <p>Files having the name <var>extension</var> will be served by the specified <var><a href="../handler.html">handler-name</a></var>. This mapping is added to any already in force, overriding any mappings that already exist for the same <var>extension</var>. For example, to activate CGI scripts with the file extension <code>.cgi</code>, you might use:</p> <div class="example"><p><code> AddHandler cgi-script .cgi </code></p></div> <p>Once that has been put into your httpd.conf file, any file containing the <code>.cgi</code> extension will be treated as a CGI program.</p> <p>The <var>extension</var> argument is case-insensitive, and can be specified with or without a leading dot.</p><h3>See also</h3><ul><li><code class="directive"><a href="../mod/core.html#sethandler">SetHandler</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddInputFilter" id="AddInputFilter">AddInputFilter</a> <a name="addinputfilter" id="addinputfilter">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps filename extensions to the filters that will processclient requests</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddInputFilter <var>filter</var>[;<var>filter</var>...]<var>extension</var> [<var>extension</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>AddInputFilter is only available in Apache 2.0.26 andlater.</td></tr></table> <p><code class="directive">AddInputFilter</code> maps the filename extension <var>extension</var> to the <a href="../filter.html">filters</a> which will process client requests and POST input when they are received by the server. This is in addition to any filters defined elsewhere, including the <code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code> directive. This mapping is merged over any already in force, overriding any mappings that already exist for the same <var>extension</var>.</p> <p>If more than one filter is specified, they must be separated by semicolons in the order in which they should process the content. Both the filter and <var>extension</var> arguments are case-insensitive, and the extension may be specified with or without a leading dot.</p><h3>See also</h3><ul><li><code class="directive"><a href="#removeinputfilter">RemoveInputFilter</a></code></li><li><code class="directive"><a href="../mod/core.html#setinputfilter">SetInputFilter</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddLanguage" id="AddLanguage">AddLanguage</a> <a name="addlanguage" id="addlanguage">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extension to the specified contentlanguage</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddLanguage <var>MIME-lang</var> <var>extension</var>[<var>extension</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr></table> <p>The <code class="directive">AddLanguage</code> directive maps the given filename extension to the specified content language. <var>MIME-lang</var> is the MIME language of filenames containing <var>extension</var>. This mapping is added to any already in force, overriding any mappings that already exist for the same <var>extension</var>.</p> <div class="example"><h3>Example</h3><p><code> AddEncoding x-compress .Z<br /> AddLanguage en .en<br /> AddLanguage fr .fr </code></p></div> <p>Then the document <code>xxxx.en.Z</code> will be treated as being a compressed English document (as will the document <code>xxxx.Z.en</code>). Although the content language is reported to the client, the browser is unlikely to use this information. The <code class="directive">AddLanguage</code> directive is more useful for <a href="../content-negotiation.html">content negotiation</a>, where the server returns one from several documents based on the client's language preference.</p> <p>If multiple language assignments are made for the same extension, the last one encountered is the one that is used. That is, for the case of:</p> <div class="example"><p><code> AddLanguage en .en<br /> AddLanguage en-gb .en<br /> AddLanguage en-us .en </code></p></div> <p>documents with the extension <code>.en</code> would be treated as being <code>en-us</code>.</p> <p>The <var>extension</var> argument is case-insensitive, and can be specified with or without a leading dot.</p><h3>See also</h3><ul><li><code class="module"><a href="../mod/mod_negotiation.html">mod_negotiation</a></code></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="AddOutputFilter" id="AddOutputFilter">AddOutputFilter</a> <a name="addoutputfilter" id="addoutputfilter">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps filename extensions to the filters that will processresponses from the server</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilter <var>filter</var>[;<var>filter</var>...]<var>extension</var> [<var>extension</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_mime</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>AddOutputFilter is only available in Apache 2.0.26 andlater.</td></tr></table> <p>The <code class="directive">AddOutputFilter</code> directive maps the filename extension <var>extension</var> to the <a href="../filter.html">filters</a> which will process responses from the server before they are sent to the client. This is in 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/core.html#addoutputfilterbytype">AddOutputFilterByType</a></code> directive. This mapping is merged over any already in force, overriding any mappings that already exist for the same <var>extension</var>.</p> <p>For example, the following configuration will process all <code>.shtml</code> files for server-side includes and will then compress the output using <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>.</p> <div class="example"><p><code> AddOutputFilter INCLUDES;DEFLATE shtml </code></p></div>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -