Home / Guides / Your site

2 min read ยท Updated

Password-protect a directory

Lock a folder behind a username and password — useful for staging sites, admin areas, or anything you don't want public yet.

Set it up

  1. In cPanel, open Directory Privacy.
  2. Navigate to the folder you want to protect (e.g. public_html/staging) and click its name.
  3. Tick Password protect this directory and give it a label (this appears in the browser's login prompt). Click Save.
  4. Under Create User, set a username and password, then click Save.

Anyone visiting that folder's URL will now see a login prompt. They need the username and password you just created — it's separate from their cPanel login.

Add more users

Go back into the same directory in Directory Privacy and create additional users. Each person can have their own credentials.

Remove the protection

  1. Open the directory again in Directory Privacy.
  2. Untick Password protect this directory and click Save.

Protect your entire site

To password-protect everything, apply the protection to public_html itself. This is handy while you're building a site and don't want anyone stumbling onto it.

← All guides

Stuck on a step? Email support@dredgehost.com and we'll help you sort it out.

Did this guide help? A short review on Trustpilot helps other people find a small host they can trust.