Question: How do I password protect a directory on my website?
Answer: Many web hosting control panels offer a “password protect” feature for your directories. If not, there is a moderately easy way to do it with an Apache .htaccess file.
First, create an .htaccess file that looks like this:
AuthName “Password Protected”
require user yourname
Replace “yourname” with your desired username. Next, you will need to create the .htpasswd file in the location you specified. This requires you to have an encrypted password entry:
Use the following form to create one: Htpasswd Generator.