Thursday , 11 August 2022
Home > htaccess > Htaccess Supersession

Htaccess Supersession

Htaccess Supersession – The most common place to upload an .htaccess file is the root ie. the home page of your website. This is because so many things can be controlled from the top level.

However, there are many occasions when you will need to upload an .htaccess file to a sub directory.

Htaccess Password Protect

For example, if you want to password protect a directory you need to place the .htaccess file in the directory you want to protect.

The important thing to remember is that any code in a subdirectory .htaccess file supercedes the one in the directory above.

However, it only supercedes it when there is a clash. I’ll explain this with an example.

Lets say your root .htaccess and your subdirectory .htaccess file both state how a 404 error should be treated.

If someone tries to view a page which has been deleted within the subdirectory then the user will be redirected according to the rule stated in the subdirectory .htaccess file ie. it supercedes the htaccess on the home page.

If, however, the user tries to view an incorrect url in the root directory, the root .htaccess file will dictate what will happen.

About Whendy

Whendy Blog mengumpulkan beberapa Tutorial Website, PHP, AngularJS, JQuery, Laravel, Codeigniter dan lain-lain. ( jika sempat ) :)

Check Also

How to Stop Directory Listing

How to Stop Directory Listing – If you have a lot of files in a ...

Leave a Reply

Your email address will not be published. Required fields are marked *