password protection with htaccess
Monday, September 25th, 2006Here 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> require valid-user </LIMIT> #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