a) Login to your website CPanel
b) Search for the option of “Password Protection” under security and click on it
c) In the populated window browse to the folder or directory for which you want to restrict the access
d) Now click on the name of the directory
e) It will show you a form where you have to mention the requested information.
f) Enter the username/password and save it.