You can easily password protect directories using the “Password Protect: Directories” feature in your hosting control panel (cPanel). Here’s how:
Login to your hosting control panel (cPanel) and click password protect directories in the security section.
In the window that opens the default selection is web root. Leave that if it’s a directory inside of your site such as http://example.com/directory/ that you want to password protect. If you want to password protect the entire site so http://example.com/ is password protected select the document root option. Then click the blue go button.
Now you’ll see a list of directories. If you want to password protect one of the directories in this list click the name of the directory. If the directory you want to password protect is in one of the directories click the folder icon to move into a directory. Once you find the folder you want to password protect click the name of the folder.
At the top check the box to password protect the directory then put in a name. The name can be anything to like. I used members only for example. Click save.
Put in a username and I suggest using the password generator to create a good secure password. Then click add/modify authorized user.
Now you can add more users as needed and you can also delete users if needed. To change the password for a user just add the user again that will overwrite the password for that user.