The name ‘
.htaccess‘ isn’t universally acceptable, though.
Sometimes it can quite difficult to persuade a system to let you create
or edit a file with such a name. For this reason, you can change the
name that Apache will use when looking for these per-directory
config files by using the
AccessFileName directive in your
httpd.conf file. For instance,
will cause Apache to look for files named
.htaccess. They'll be treated the same way, though,
and they're still called '
When Apache determines that a requested resource actually represents
a file on the disk, it starts a process called the 'directory walk.'
This involves checking through its internal list of
containers to find those that apply,
and possibly searching the directories on the filesystem for
Each time the directory walk finds a new set of directives that apply
to the request, they are merged with the settings already
accumulated. The result is a collection of settings that apply to
the final document, culled from all of its ancestor directories and
the server's config files.
When searching for
.htaccessfiles, Apache starts at the
top of the filesystem. (On Windows, that usually means '
otherwise, the root directory '
/'.) It then walks down the
directories to the one containing the final document, processing and merging
.htaccessfiles it finds that the config files say should
be processed. (See the section on overrides
for more information on how the server determines whether an
.htaccessfile should be processed or not.)
This can be an intensive process. Consider a request for
which resolves to the fileC:Program FilesApache GroupApachehtdocsfoobargritchx.html
Unless instructed otherwise, Apache is going to look for each of the
.htaccessfiles, and process any it finds:
- C:Program Files.htaccess
- C:Program FilesApache Group.htaccess
- C:Program FilesApache GroupApache.htaccess
- C:Program FilesApache GroupApachehtdocs.htaccess
- C:Program FilesApache GroupApachehtdocsfoo.htaccess
- C:Program FilesApache GroupApachehtdocsfoobar.htaccess
- C:Program FilesApache GroupApachehtdocsfoobargritch.htaccess
That's a lot of work just to return a single file! And the server will
repeat this process each and every time the file is requested. See
the overrides section for a way to reduce
this overhead with the