Protect a Directory with Apache, .htaccess and httpasswd
Apache comes with a command line utility called "htpasswd". This utility will generate a username and password that you can use to authenticate against using a .htaccess file. Just run the utility like so:
htpasswd -c /path/to/your/password/directory/a...
Written by Sean Behan on 06/17/2012