1. Create the directory to be password protected (in this example, we created /home/httpd/html/systems/pc/secured). You may need to change ownership (chown command) of the directory. It should be owned by the Apache user - for me it is user: nobody and group: nobody (chown nobody.nobody /home/httpd/html/systems/pc/secured).
2. Edit the file /etc/httpd/conf/httpd.conf (it was /etc/httpd/conf/access.conf for older versions of Apache). At the bottom of the file, add the following:
AuthName "PC Systems Secured Area"
AuthType Basic
AuthUserFile /etc/httpd/auth/.htpasswd-pcsys
Require valid-user
3. Add users to the htpasswd file.
htpasswd-c /etc/httpd/auth/.htpasswd-pcsys username-to-add (use -c to create a new htpasswd file)
htpasswd /etc/httpd/auth/.htpasswd-pcsys username-to-add (use this to add to an existing file)
Restart httpd to load the updated access.conf (/etc/rc.d/init.d/httpd restart). There is no need to restart httpd if you are only adding new users to an existing htpasswd file.