Skip to content

Instantly share code, notes, and snippets.

@biswarupadhikari
Created November 1, 2012 12:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biswarupadhikari/3993445 to your computer and use it in GitHub Desktop.
Save biswarupadhikari/3993445 to your computer and use it in GitHub Desktop.
How to Password Protect Directory Usiing .htaccess file
AuthName "Secure Area"
AuthType Basic
AuthUserFile /home/adidac/.htpasswd
require valid-user
user1:$apr1$VbiZFY..$oMHWe5aNzsSZY.82QY8hp1
user2:$apr1$BzCdmMtk$X3a.Qrsa4T7M.YPcfUvCt0
Step 1 : Create htaccess file under the directory which u want to protect.
AuthName "Secure Area"
AuthType Basic
AuthUserFile /home/adidac/.htpasswd
require valid-user
Step 2 : Generate Username Password Pair
Open Terminal : $ htpasswd -nb user1 123456
OutPut Will Be : $ user1:$apr1$VbiZFY..$oMHWe5aNzsSZY.82QY8hp1
Step 3 : Create htpasswd file Database
create file let .htpasswd
generated string in terminal (user1:$apr1$VbiZFY..$oMHWe5aNzsSZY.82QY8hp1)
NB: If you need Multiple User Add In Multiple Line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment