You can make visitors enter a username and password before they can see a folder on your website, for
example while you build a site or for a members-only area.
Protecting a folder
- In cPanel, open Directory Privacy (in the Files section).
- Click the folder names to move around, and click Edit next to the folder you want to protect.
The folder is called public_html for your main website.
- Tick Password protect this directory.
- Enter a name for the protected directory. Visitors see this name in the login box.
- Click Save, then Go Back.
- Under Create User, enter a username and a password (and type the password again, or use
Password Generator), and click Save.
From then on, anyone opening that folder in a browser is asked for the username and password.
Adding and removing users
Open the folder in Directory Privacy again. Create more users in the same way. To remove one,
choose them in the Authorized Users list and click Delete User. To remove protection from the
folder, untick Password protect this directory and save.
If you cannot create a user, set the folder's permissions to 0700 in File Manager and try again:
see File and folder permissions.
Things to know
- Protecting
public_html protects your whole website, including pages visitors need.
- It protects the folder and everything inside it.
- The password protects pages in a browser. It does not protect access by FTP, SFTP or Web Disk.
- Do not use your cPanel password here. Use a separate one.