📄 mod_mime.html.en
字号:
<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 <var>filter</var> 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="#removeoutputfilter">RemoveOutputFilter</a></code></li><li><code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</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="AddType" id="AddType">AddType</a> <a name="addtype" id="addtype">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps the given filename extensions onto the specified contenttype</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddType <var>MIME-type</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">AddType</code> directive maps the given filename extensions onto the specified content type. <var>MIME-type</var> is the MIME type to use for 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>. This directive can be used to add mappings not listed in the MIME types file (see the <code class="directive"><a href="#typesconfig">TypesConfig</a></code> directive).</p> <div class="example"><h3>Example</h3><p><code> AddType image/gif .gif </code></p></div> <div class="note"> It is recommended that new MIME types be added using the <code class="directive">AddType</code> directive rather than changing the <code class="directive"><a href="#typesconfig">TypesConfig</a></code> file. </div> <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#defaulttype">DefaultType</a></code></li><li><code class="directive"><a href="../mod/core.html#forcetype">ForceType</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="DefaultLanguage" id="DefaultLanguage">DefaultLanguage</a> <a name="defaultlanguage" id="defaultlanguage">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets all files in the given scope to the specifiedlanguage</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>DefaultLanguage <var>MIME-lang</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">DefaultLanguage</code> directive tells Apache that all files in the directive's scope (<em>e.g.</em>, all files covered by the current <code class="directive"><a href="../mod/core.html#directory"><Directory></a></code> container) that don't have an explicit language extension (such as <code>.fr</code> or <code>.de</code> as configured by <code class="directive"><a href="#addlanguage">AddLanguage</a></code>) should be considered to be in the specified <var>MIME-lang</var> language. This allows entire directories to be marked as containing Dutch content, for instance, without having to rename each file. Note that unlike using extensions to specify languages, <code class="directive">DefaultLanguage</code> can only specify a single language.</p> <p>If no <code class="directive">DefaultLanguage</code> directive is in force, and a file does not have any language extensions as configured by <code class="directive"><a href="#addlanguage">AddLanguage</a></code>, then that file will be considered to have no language attribute.</p> <div class="example"><h3>Example</h3><p><code> DefaultLanguage en </code></p></div><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="ModMimeUsePathInfo" id="ModMimeUsePathInfo">ModMimeUsePathInfo</a> <a name="modmimeusepathinfo" id="modmimeusepathinfo">Directive</a></h2><table class="directive"><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>components as part of the filename</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ModMimeUsePathInfo On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ModMimeUsePathInfo Off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</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>Available in Apache 2.0.41 and later</td></tr></table> <p>The <code class="directive">ModMimeUsePathInfo</code> directive is used to combine the filename with the <code>path_info</code> URL component to apply <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code>'s directives to the request. The default value is <code>Off</code> - therefore, the <code>path_info</code> component is ignored.</p> <p>This directive is recommended when you have a virtual filesystem.</p> <div class="example"><h3>Example</h3><p><code> ModMimeUsePathInfo On </code></p></div> <p>If you have a request for <code>/bar/foo.shtml</code> where <code>/bar</code> is a Location and <code class="directive">ModMimeUsePathInfo</code> is <code>On</code>, <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> will treat the incoming request as <code>/bar/foo.shtml</code> and directives like <code>AddOutputFilter INCLUDES .shtml</code> will add the <code>INCLUDES</code> filter to the request. If <code class="directive">ModMimeUsePathInfo</code> is not set, the <code>INCLUDES</code> filter will not be added.</p><h3>See also</h3><ul><li><code class="directive"><a href="../mod/core.html#acceptpathinfo">AcceptPathInfo</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="MultiviewsMatch" id="MultiviewsMatch">MultiviewsMatch</a> <a name="multiviewsmatch" id="multiviewsmatch">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The types of files that will be included when searching fora matching file with MultiViews</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MultiviewsMatch Any|NegotiatedOnly|Filters|Handlers[Handlers|Filters]</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MultiviewsMatch NegotiatedOnly</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>Available in Apache 2.0.26 and later.</td></tr></table> <p><code class="directive">MultiviewsMatch</code> permits three different behaviors for <a href="mod_negotiation.html">mod_negotiation</a>'s Multiviews feature. Multiviews allows a request for a file, <em>e.g.</em> <code>index.html</code>, to match any negotiated extensions following the base request, <em>e.g.</em> <code>index.html.en</code>, <code>index.html.fr</code>, or <code>index.html.gz</code>.</p> <p>The <code>NegotiatedOnly</code> option provides that every extension following the base name must correlate to a recognized <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> extension for content negotation, <em>e.g.</em> Charset, Content-Type, Language, or Encoding. This is the strictest implementation with the fewest unexpected side effects, and is the default behavior.</p> <p>To include extensions associated with Handlers and/or Filters, set the <code class="directive">MultiviewsMatch</code> directive to either <code>Handlers</code>, <code>Filters</code>, or both option keywords. If all other factors are equal, the smallest file will be served, <em>e.g.</em> in deciding between <code>index.html.cgi</code> of 500 bytes and <code>index.html.pl</code> of 1000 bytes, the <code>.cgi</code> file would win in this example. Users of <code>.asis</code> files might prefer to use the Handler option, if <code>.asis</code> files are associated with the <code>asis-handler</code>.</p> <p>You may finally allow <code>Any</code> extensions to match, even if <code class="module"><a href="../mod/mod_mime.html">mod_mime</a></code> doesn't recognize the extension. This was the behavior in Apache 1.3, and can cause unpredicatable results, such as serving .old or .bak files the webmaster never expected to be served.</p> <p>For example, the following configuration will allow handlers and filters to participate in Multviews, but will exclude unknown files:</p> <div class="example"><p><code> MultiviewsMatch Handlers Filters </code></p></div><h3>See also</h3><ul><li><code class="directive"><a href="../mod/core.html#options">Options</a></code></li><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="RemoveCharset" id="RemoveCharset">RemoveCharset</a> <a name="removecharset" id="removecharset">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any character set associations for a set of fileextensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveCharset <var>extension</var> [<var>extension</var>]...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>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>RemoveCharset is only available in Apache 2.0.24 andlater.</td></tr></table> <p>The <code class="directive">RemoveCharset</code> directive removes any character set associations for files with the given extensions. This allows <code>.htaccess</code> files in subdirectories to undo any associations inherited from parent directories or the server config files.</p> <p>The <var>extension</var> argument is case-insensitive, and can be specified with or without a leading dot.</p> <div class="example"><h3>Example</h3><p><code> RemoveCharset .html .shtml </code></p></div></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RemoveEncoding" id="RemoveEncoding">RemoveEncoding</a> <a name="removeencoding" id="removeencoding">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Removes any content encoding associations for a set of fileextensions</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RemoveEncoding <var>extension</var> [<var>extension</var>]...</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>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">RemoveEncoding</code> directive removes any encoding associations for files with the given extensions. This allows <code>.htaccess</code> files in subdirectories to undo any associations inherited from parent directories or the server config files. An example of its use might be:</p> <div class="example"><h3>/foo/.htaccess:</h3><p><code> AddEncoding x-gzip .gz<br /> AddType text/plain .asc<br /> <Files *.gz.asc><br /> <span class="indent"> RemoveEncoding .gz<br />
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -