.htaccess container or using htaccess file

by rajesh 2007-06-08 08:00:24

We know that the way apache works is controlled by apache directives and the directives can be used at four different levels called as containers.

htaccess is one such container. htaccess is nothing but a file with a set of apache directives in it. We can create a .htaccess file under any folder or path.

So if we need to set a specific directive or access rule to files and sub folders under a certain directory, we will create a htaccess file under that directory and add the directives in it.

When searching for .htaccess files, Apache starts at the root folder and goes down.
e.g:
1 C:\.htaccess
2 C:\Program Files\.htaccess
3 C:\Program Files\Apache Group\.htaccess

While going down the order apache merges the .htacces files and replaces any directive set in the sub folder with the previous one.

Say "AllowOverride None" is set in a htaccess file under
C:\Program Files\.htaccess
while "AllowOverride All" in set in a htaccess file under
C:\Program Files\Apache Group\.htaccess

Here all files and sub folders of C:\Program Files\Apache Group\ will only use the directive "AllowOverride All" while files and sub folders of C:\Program Files\ will use "AllowOverride None"

The name of the access file by default is .htaccess. But this can be modified by changing the directive AccessFileName in httpd.conf file.

Tagged in:

3805
like
0
dislike
0
mail
flag

You must LOGIN to add comments