If you would like to password protect a directory, create a .htaccess file in a directory which you wish to protect and insert the following parameters:

AuthUserFile /home/username/.htpasswd
AuthGroupFile /dev/null
AuthName “Private Area”
AuthType Basic

require valid-user


replace the “username” with the actual username. Create a .htpasswd file and place the username/password in the following format:


You can place as many users you wish in the .htpasswd file

Was this post helpful?