Apache, how to protect directory with a password

Another Q&EG.

Step 1: create .htpasswd file in your directory (or any other location on the server actually)

htpasswd -c .htpasswd username

Step2: create file / add following lines to the existing file; make sure AuthUserFile directive have full path.


AuthUserFile /var/www/www.site.com/html/.htpasswd
AuthType Basic
AuthName "Password Pup-up Title"

Step3: Enjoy.

Posted on March 5, 2012 at 12:15 by admin · Permalink
In: English, Q&EG · Tagged with: 

Leave a Reply