If you would like to protect a subdirectory with a basic username and password
Authtype Basic AuthName "Put whatever you want here" AuthUserFile <path to your htpasswd file> Require valid-user
The path to your file should be your full Unix home directory.
- Creating a password file is done by using the “htpasswd” command like this:
htpasswd -c /httpdocs/foo/.htpasswd fred
The “-c” option creates the file for the first time. Don’t use it if you are adding another user to an existing file. “fred” is the username you are adding. It will then ask you for a password and then to confirm it. After that you should be able to access the URL and be asked for the username and password.