For beginners, this is the best way to restrict access to a certain directory within your site. Advanced users can refer to our guide on “How to Password Protect a Directory” for info on how to do this manually.
Step 1: Login & Navigate to Password Protect Directories
Log in to your cPanel account and click on the Password Protect Directories icon the Security tab. When prompted select Web Root and click Go.
Step 2: Select Directory
Select the directory you wish to password protect by clicking on it.
Step 3: Security Settings
When the security settings screen loads check the Password protect this directory box then, directly under that, fill in the box with what you would like the protected directory to be called. M
Note: This will not change the name of the actual file, this is the name that will display in a browser before the user is verified by their new password credentials.
Step 4: Create User
To create a user fill in the boxes as prompted - feel free to use the password generator should you wish to be extra secure. Click Add/Modify authorized user to complete.
Note: You'll now see a screen confirming the new user, if you click “go back” you'll now see that a box has been added to the previous screen, where you can select and modify existing users.
Step 5: Test Your Password Directory
If you now navigate to that directory within a web browser (www.yoursite.com/file.) You'll see that access is now restricted, unless the visitor can provide an approved username and password.