Securing A Directory With .htaccess
October 6th, 2008
It’s actually quite simple.
Create a .htaccess file in the directory with the following contents:
AuthUserFile /directory/containing/.htpasswd
AuthName “Title for Protected Site”
AuthType Basic
Require valid-user
To create the .htpasswd file, simple use the following command:
htpasswd2 -c .htpasswd hayden
And it will create the appropriate .htpasswd file in the directory you are in.