Protect a web directory with password

Tue 31 July 2007
    vim /path/of/your/dir/.htaccess

Paste this into:

    AuthType Basic
    AuthName "Private Dir"
    AuthUserFile /path/of/your/dir/.htpasswd
    require valid-user

Then we must create the password file /path/of/your/dir/.htpasswd.

We want to log in with the username "user", so we do this:

    htpasswd -c /path/of/your/dir/.htpasswd user

Enter a password for "user", and you're done!