provide a way to make configuration changes on a per-directory basis. A
file, containing one or more configuration directives, is placed in a
particular document directory, and the directives apply to that
directory, and all subdirectories thereof.</p>
<div class="note"><h3>Note:</h3>
<p>If you want to call your <code>.htaccess</code> file something
else, you can change the name of the file using the <code class="directive"><a href="../mod/core.html#accessfilename">AccessFileName</a></code> directive. For example,
if you would rather call the file <code>.config</code> then you
can put the following in your server configuration file:</p>
<div class="example"><p><code>
AccessFileName .config
</code></p></div>
</div>
<p>In general, <code>.htaccess</code> files use the same syntax as
the <a href="../configuring.html#syntax">main configuration
files</a>. What you can put in these files is determined by the
<code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code> directive. This
directive specifies, in categories, what directives will be
honored if they are found in a <code>.htaccess</code> file. If a
directive is permitted in a <code>.htaccess</code> file, the
documentation for that directive will contain an Override section,
specifying what value must be in <code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code> in order for that
directive to be permitted.</p>
<p>For example, if you look at the documentation for the <code class="directive"><a href="../mod/core.html#adddefaultcharset">AddDefaultCharset</a></code>
directive, you will find that it is permitted in <code>.htaccess</code>
files. (See the Context line in the directive summary.) The <a href="../mod/directive-dict.html#Context">Override</a> line reads
<code>FileInfo</code>. Thus, you must have at least
<code>AllowOverride FileInfo</code> in order for this directive to be
<p>When you put configuration directives in a <code>.htaccess</code>
file, and you don't get the desired effect, there are a number of
things that may be going wrong.</p>
<p>Most commonly, the problem is that <code class="directive"><a href="../mod/core.html#allowoverride">AllowOverride</a></code> is not
set such that your configuration directives are being honored. Make
sure that you don't have a <code>AllowOverride None</code> in effect
for the file scope in question. A good test for this is to put garbage
in your <code>.htaccess</code> file and reload. If a server error is
not generated, then you almost certainly have <code>AllowOverride
None</code> in effect.</p>
<p>If, on the other hand, you are getting server errors when trying to
access documents, check your Apache error log. It will likely tell you
that the directive used in your <code>.htaccess</code> file is not
permitted. Alternately, it may tell you that you had a syntax error,
which you will then need to fix.</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../en/howto/htaccess.html" title="English"> en </a> |
<a href="../ja/howto/htaccess.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../ko/howto/htaccess.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
</div><div id="footer">
<p class="apache">Copyright 1999-2004 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>