How to Password Protect sections of your website

Anybody can access the content within the folder public_html (folder containing all public files of your hosting account) with a web browser. To limit or control access to particular directories within the public_html directory:

  1. Connect to cPanel
  2. Click on Directory Privacy in the Files section. It will list the folders in your account.
  3. Click on the icon to the left of a folder to see its content.
  4. Click on the folder name (as opposed to its icon) to modify its security settings.
  5. In Security Settings, check the Password protect this directory box.
  6. Enter a name for the protected directory (for example 'My protected folder')
  7. Click Save.
  8. At the bottom of the page, create a username and password to permit access to the protected folder.
  9. Click Add/modify authorized user. You can add as many authorized users as you like.
  10. You're all done! Check if the selected directory is correctly secured with the new settings by connecting to it with your web browser. For example, if you've password-protected the folder "public_html/test" on yourdomain.com, the following address will prompt you to enter a password: yourdomain.com/test

Note: You cannot password-protect individual files, only folders.

 

Article ID: #HC5047

Was this answer helpful?