password protection with htaccess

September 25, 2006 | In: tutorials

Here is a short example of password protecting a directory with htaccess and htpassword.

#put this is your .htaccess file that resides
#in the directory that you wish to protect

AuthUserFile /path/to/whereever/.users
AuthType Basic
AuthName "Miami"
<LIMIT GET POST&gt
require valid-user
</LIMIT&gt

#run this command after you add the htaccess
#command to add a user to a newuser file
sudo htpasswd -c /path/to/whereever/.users newusername

#command to add a user to an exsisting file
sudo htpasswd /path/to/whereever/.users newusername

you will then be prompted twice for the new password for the username that you chose in the command above. Thats all folks…

Enjoy,
NC

Bookmark and Share
blog comments powered by Disqus

Flickr Pics

13th and washington NYC13th and 9th NYC1st st Jersey CityIMG_2813IMG_2814_2IMG_2816IMG_2815Photo_011908_001Photo_122807_001Photo_121107_001