Home > Lab Notes > Securing A Directory With .htaccess

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.

sloik2004 Lab Notes

  1. No comments yet.
  1. No trackbacks yet.