Password Protection with .htaccess - I am Programmer 404

Post Top Ad

Post Top Ad

1 Aug 2019

Password Protection with .htaccess

Password-Protection-with-.htaccess-1
It is very easy to password protect a .htaccess file in a folder or directory. This method is called .htaccess password protection, To protect with the password you need to use two files one is .htaccess and .htpasswd and save it into the folder or directory.

Now you need to add the following code in your .htaccess file.

AuthType Basic
AuthName "Security Area"
AuthUserFile /home/user/softaox/secure/.htpasswd
Require valid-user

Once you added the code don’t forget to change the path “/home/user/softaox/secure/.htpasswd” with the full path to your .htpasswd. Now you need to upload the .htpasswd file in some of the specific folder which only contains the username and password.

Following code for .htpasswd.

Here “softaox” allows the user to access the password protected section with the password and here this is the password “9476nIHW7Esgw” to access the file.

Post Top Ad