Skip to content
HoganHost blog

Protecting Folders With Password Protected Directories in cPanel

Some parts of your website should not be open to everyone. A staging copy you are testing, a members area, or a folder of private documents all need a gate. The Directory Privacy tool, also called Password Protected Directories, puts a password prompt in front of any folder you choose.

Visitors who try to open that folder see a login box. Without the right username and password, they cannot go further.

Open Directory Privacy

  1. Log in to cPanel.
  2. In the Security group, click Directory Privacy.

Choose the Folder

  1. Open the folder tree on the page.
  2. Click the folder you want to protect, such as a staging folder inside public_html.
  3. Tick the option to password-protect this directory.

Give the protected folder a clear name in the setup screen, so visitors and you both know what it is for. This name appears in the login prompt.

Set the Login

  1. Type a name for the protected area.
  2. Click Save.
  3. When the page reloads, the login details for this folder are set up automatically or through a separate user step, depending on your screen.

Create a strong password, and use a different one from your cPanel login. Share it only with people who need access.

Test the Gate

Open the protected folder in a private browser window. You should see the login prompt before any content loads. Enter the wrong details once, then the right ones, to confirm both work.

Remove Protection

When the folder no longer needs a gate, return to Directory Privacy, untick the folder, and save. Removing the protection does not delete the folder or its files.

Keeping staging sites and private folders on a secure setup takes planning. HoganHost’s cPanel shared hosting gives you the tools to set this up for each project on one account.

Share this article
Written by

Join the conversation.

Your email address will not be published. Required fields are marked *

Your next chapter starts here

Put your next big idea online.

The right hosting. A name of your own. A real team in your corner.

Explore Hosting