Simple .htaccess protection

Jump to navigationJump to search


Because I bet many of you that don't have knowledge about this kind of stuff wanted to know how is this done ... it's actually more simple than you think !


Put this in a file named ".htaccess" in a directory you want to be protected.

AuthType Basic
AuthName "Password Required"
AuthUserFile /full/path/to/your/.passwds
Require valid-user

In the command line for the first user do this ( for all the other users you can drop the -c ) :

htpasswd -c .passwds dexter
#New password:
#Re-type new password:
#Adding password for user dexter


Apache Tutorial: .htaccess files