Amit Dhamu

Writes Code

HTTP Authentication

To secure a folder with HTTP Authentication, first add the following lines to your .htaccess file.

#  Location of your password file (must be a full path)
AuthUserFile /usr/local/bin/pass.htpasswd
AuthName "Enter Login Details"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>

Then go here to generate a password. Copy this password, which will look something like amit:$apr1$CpS6cy3S$Gwptn4Wc0SHUyMVgrjxxw/ to a text file and save it as pass.txt.

When you have done this, right click on the text file, change the extension to htpasswd and upload it to the location you specified in your .htaccess file above.


http / authentication / security / apache / htaccess

← Toggle Text Function Double Click Event →