Skip to main content

.htaccess: How .htaccess directives are applied

How .htaccess directives are applied

The configuration directives in an .htaccess file are applied to the directory where the .htaccess file is located and all its subdirectories.

It is important to also remember that there may have been .htaccess files in directories higher up.


Directives are applied in the order that they are found!

Therefore, an .htaccess file in a particular directory can override directives found in .htaccess files located higher up in the directory tree. And those, in turn, can override directives located even higher up, or in the main configuration file of the server itself.