📄 core.html.en
字号:
</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="AccessFileName" id="AccessFileName">AccessFileName</a> <a name="accessfilename" id="accessfilename">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Name of the distributed configuration file</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AccessFileName <var>filename</var> [<var>filename</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AccessFileName .htaccess</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr></table> <p>While processing a request the server looks for the first existing configuration file from this list of names in every directory of the path to the document, if distributed configuration files are <a href="#allowoverride">enabled for that directory</a>. For example:</p> <div class="example"><p><code> AccessFileName .acl </code></p></div> <p>before returning the document <code>/usr/local/web/index.html</code>, the server will read <code>/.acl</code>, <code>/usr/.acl</code>, <code>/usr/local/.acl</code> and <code>/usr/local/web/.acl</code> for directives, unless they have been disabled with</p> <div class="example"><p><code> <Directory /><br /> <span class="indent"> AllowOverride None<br /> </span> </Directory> </code></p></div><h3>See also</h3><ul><li><code class="directive"><a href="#allowoverride">AllowOverride</a></code></li><li><a href="../configuring.html">Configuration Files</a></li><li><a href="../howto/htaccess.html">.htaccess Files</a></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="AddDefaultCharset" id="AddDefaultCharset">AddDefaultCharset</a> <a name="adddefaultcharset" id="adddefaultcharset">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default charset parameter to be added when a responsecontent-type is <code>text/plain</code> or <code>text/html</code></td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddDefaultCharset On|Off|<var>charset</var></code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AddDefaultCharset Off</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>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr></table> <p>This directive specifies a default value for the media type charset parameter (the name of a character encoding) to be added to a response if and only if the response's content-type is either <code>text/plain</code> or <code>text/html</code>. This should override any charset specified in the body of the response via a <code>META</code> element, though the exact behavior is often dependent on the user's client configuration. A setting of <code>AddDefaultCharset Off</code> disables this functionality. <code>AddDefaultCharset On</code> enables a default charset of <code>iso-8859-1</code>. Any other value is assumed to be the <var>charset</var> to be used, which should be one of the <a href="http://www.iana.org/assignments/character-sets">IANA registered charset values</a> for use in MIME media types. For example:</p> <div class="example"><p><code> AddDefaultCharset utf-8 </code></p></div> <p><code class="directive">AddDefaultCharset</code> should only be used when all of the text resources to which it applies are known to be in that character encoding and it is too inconvenient to label their charset individually. One such example is to add the charset parameter to resources containing generated content, such as legacy CGI scripts, that might be vulnerable to cross-site scripting attacks due to user-provided data being included in the output. Note, however, that a better solution is to just fix (or delete) those scripts, since setting a default charset does not protect users that have enabled the "auto-detect character encoding" feature on their browser.</p><h3>See also</h3><ul><li><code class="directive"><a href="../mod/mod_mime.html#addcharset">AddCharset</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="AddOutputFilterByType" id="AddOutputFilterByType">AddOutputFilterByType</a> <a name="addoutputfilterbytype" id="addoutputfilterbytype">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>assigns an output filter to a particular MIME-type</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]<var>MIME-type</var> [<var>MIME-type</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>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.33 and later; deprecated in Apache 2.1 and later</td></tr></table> <p>This directive activates a particular output <a href="../filter.html">filter</a> for a request depending on the response <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME-type</a>. Because of certain problems discussed below, this directive is deprecated. The same functionality is available using <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>.</p> <p>The following example uses the <code>DEFLATE</code> filter, which is provided by <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. It will compress all output (either static or dynamic) which is labeled as <code>text/html</code> or <code>text/plain</code> before it is sent to the client.</p> <div class="example"><p><code> AddOutputFilterByType DEFLATE text/html text/plain </code></p></div> <p>If you want the content to be processed by more than one filter, their names have to be separated by semicolons. It's also possible to use one <code class="directive">AddOutputFilterByType</code> directive for each of these filters.</p> <p>The configuration below causes all script output labeled as <code>text/html</code> to be processed at first by the <code>INCLUDES</code> filter and then by the <code>DEFLATE</code> filter.</p> <div class="example"><p><code> <Location /cgi-bin/><br /> <span class="indent"> Options Includes<br /> AddOutputFilterByType INCLUDES;DEFLATE text/html<br /> </span> </Location> </code></p></div> <div class="warning"><h3>Note</h3> <p>Enabling filters with <code class="directive">AddOutputFilterByType</code> may fail partially or completely in some cases. For example, no filters are applied if the <a class="glossarylink" href="../glossary.html#mime-type" title="see glossary">MIME-type</a> could not be determined and falls back to the <code class="directive"><a href="#defaulttype">DefaultType</a></code> setting, even if the <code class="directive"><a href="#defaulttype">DefaultType</a></code> is the same.</p> <p>However, if you want to make sure, that the filters will be applied, assign the content type to a resource explicitly, for example with <code class="directive"><a href="../mod/mod_mime.html#addtype">AddType</a></code> or <code class="directive"><a href="#forcetype">ForceType</a></code>. Setting the content type within a (non-nph) CGI script is also safe.</p> </div><h3>See also</h3><ul><li><code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li><li><code class="directive"><a href="#setoutputfilter">SetOutputFilter</a></code></li><li><a href="../filter.html">filters</a></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="AllowEncodedSlashes" id="AllowEncodedSlashes">AllowEncodedSlashes</a> <a name="allowencodedslashes" id="allowencodedslashes">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether encoded path separators in URLs are allowed tobe passed through</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowEncodedSlashes On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowEncodedSlashes Off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.46 and later</td></tr></table> <p>The <code class="directive">AllowEncodedSlashes</code> directive allows URLs which contain encoded path separators (<code>%2F</code> for <code>/</code> and additionally <code>%5C</code> for <code>\</code> on according systems) to be used. Normally such URLs are refused with a 404 (Not found) error.</p> <p>Turning <code class="directive">AllowEncodedSlashes</code> <code>On</code> is mostly useful when used in conjunction with <code>PATH_INFO</code>.</p> <div class="note"><h3>Note</h3> <p>Allowing encoded slashes does <em>not</em> imply <em>decoding</em>. Occurrences of <code>%2F</code> or <code>%5C</code> (<em>only</em> on according systems) will be left as such in the otherwise decoded URL string.</p> </div><h3>See also</h3><ul><li><code class="directive"><a href="#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="AllowOverride" id="AllowOverride">AllowOverride</a> <a name="allowoverride" id="allowoverride">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Types of directives that are allowed in<code>.htaccess</code> files</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowOverride All|None|<var>directive-type</var>[<var>directive-type</var>] ...</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowOverride All</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>Core</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>core</td></tr></table> <p>When the server finds an <code>.htaccess</code> file (as specified by <code class="directive"><a href="#accessfilename">AccessFileName</a></code>) it needs to know which directives declared in that file can override earlier configuration directives.</p> <div class="note"><h3>Only available in <Directory> sections</h3> <code class="directive">AllowOverride</code> is valid only in <code class="directive"><a href="#directory"><Directory></a></code> sections specified without regular expressions, not in <code class="directive"><a href="#location"><Location></a></code>, <code class="directive"><a href="#directorymatch"><DirectoryMatch></a></code> or <code class="directive"><a href="#files"><Files></a></code> sections. </div> <p>When this directive is set to <code>None</code>, then <a href="#accessfilename">.htaccess</a> files are completely ignored.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -