Question
How does Apache apply .htaccess directives, and in what order are they read?
Answer
Apache reads .htaccess files starting from the top-level directory of the document root and then any subdirectories within the request. The rules are applied in the order they are read.
For example, the .htaccess located in the public_html directory will also affect any of the subdirectories within it.
/home/user/public_html/
\__uploads
\__store
\__blog
Any .htaccess rules can override previous directives found in the parent directories as they are applied in the order that they are read. This means that if you have a rule that you wish not to apply to a subdirectory, you will have to override the directive in its .htaccess to change the behaviour.
Additional Resources
Apache's official htaccess documentation.
Comments
0 comments
Article is closed for comments.