You can limit access to certain resources of your website by password protecting the directories they are in.When you choose to password protect a directory in cpanel,It creates a rule in .htaccess file.This rule specifies that the folder is protected and the visitor will need to provide the proper username and password to log in and view the files.
Steps to password Protect Directories
step1: Log into cpanel
step2: Go to Files section and click on Directory privacy icon
step3:Select the directory you want to password protect and then you will see the set Permission screen appear.Here you can provide a name for the folder you are trying to protect.
step4:Next,click on the checkbox labled password protect the directory.Makes sure you have a name for the folder you are going to protect
step5:Click on save in order to save te name you have entered for the directory and option to password protect the directory
step6:create a user to access the protected directory
step7:click save in order to save the user that you have edited.
Removing the password protection from directory
If you are finally ready to make the folder open to the public,then you can remove the password protection so that everyone can access the files.The instruction for removing protection as follows:
Step1: Log into cpanel
Step2:Scroll down to the security section click the Password Protect Directories icon. Choose Web Root if you see a pop-up window, and then click Go
Step3:Scroll down the folder list until you see the folder you previously password protected. If the folder is a sub-folder to another one, make sure that you click on the folder icon next to the folder name. If you click on the folder name, the interface will think you’re setting protection on that folder. If you do this by accident, simply re-open the password protection interface to get back to the folder list.
Step4:When you find the folder that has been password protected,click on the folder name to select it.
Step5:Uncheck the box that says “Password protect this directory”
Step6:Click on Save