You can use .htaccess to protect a directory on your Apache web server. Users trying to access a protected directory will be asked to enter a user and password. .htaccess defines the protected directory, and .htpassword stores your password hashes.
.htaccess normally looks like this:
To create a .htpasswd file:
htpasswd -c /path.to.the.folder.you.want.to.protect/.htpasswd <username>
htpasswd -c <username>
and you will be prompted to enter a password for <username>
Of course, you can use a .htpasswd generator. Remember, Google is your friend 🙂