How to password-protect a folder

Require a username and password to view part of your website.

Updated September 27, 20261 min read

cPanel › Files › Directory Privacy

  1. Log in to cPanel.
  2. In the Files section, click Directory Privacy.
  3. Click folder names to find the folder you want to protect, then click Edit next to it.
  4. Tick Password protect this directory, enter a name for it and click Save.
  5. Go back, then under Create User enter a Username and Password for the people you want to let in.
  6. Click Save.

Visitors to that folder now have to enter the username and password.

Protecting public_html itself protects your whole website, so choose a sub-folder unless that’s what you want.

Can’t find it? Type the tool’s name into the search box at the top of cPanel.

Didn’t solve your problem?

Our team is here to help, any time, day or night.