DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 12.2 Renaming .htaccess Files

Problem

You want to change the default name of per-directory configuration files to something else, such as on a Windows system, because filenames beginning with a dot can cause problems.

Solution

Use the AccessFileName directive to specify the new name:

AccessFileName ht.access

Discussion

In addition to the server-wide configuration files, you can add directives to special files in individual directories. These are called .htaccess (aitch tee access) files because that's the default name for them.

However, the Unixish convention of filenames that begin with a dot doesn't play well on all platforms; on Windows in particular it can be difficult to edit files with such names.

Apache allows you to change the name it will use when looking for these per-directory files with the AccessFileName directive (which can only appear in the server-wide configuration files). You can use any name that's valid on your platform.

If you use the AccessFileName directive, be sure to make any additional appropriate changes to your configuration such as the <FilesMatch "^\.ht"> container that keeps the files from being fetchable over the Web:

<FilesMatch "^ht\.">
    Order deny,allow
    Deny from all
</FilesMatch>

See Also

    [ Team LiB ] Previous Section Next Section