How to Password Protect a Directory in cPanel

Password protecting a directory adds an extra layer of security by requiring visitors to enter a username and password before accessing the files inside. This is useful for staging sites, private areas of your website, or directories containing sensitive files. dotCanada's cPanel makes this easy to configure.

Setting Up Directory Password Protection

  1. Log in to cPanel and go to the Files section.
  2. Click Directory Privacy.
  3. Navigate to the directory you want to protect by clicking through the folder structure.
  4. Click the Edit button (pencil icon) next to the directory name.
  5. Check the box labelled Password protect this directory.
  6. Enter a Label - this is the message shown to visitors in the password prompt (e.g., Restricted Area).
  7. Click Save.
  8. You will be redirected to a page to create authorized users. Enter a Username and Password and click Save.

Managing Authorized Users

You can add multiple authorized users to a protected directory - useful if several people need access. To remove a user, return to the Directory Privacy page, edit the directory, and delete the user from the list.

Removing Password Protection

To remove protection, go back to the directory in Directory Privacy, uncheck Password protect this directory, and click Save.

Tips

  • Password protection uses Apache's built-in .htaccess and .htpasswd mechanism - it is reliable and does not require any plugins.
  • This feature works for any directory under your hosting account, including subdirectories of public_html.

If you need help setting up directory protection, contact our support team.

100% Satisfaction Guarantee

We're so confident you'll love dotCanada that we offer a 30-day money-back guarantee. Not satisfied? Get a full refund, no questions asked.

Ready to Get Started?

Join thousands of Canadian website owners who trust dotCanada for reliable, fast web hosting.

Get Started Today