How to Set Up Password-Protected Directories
Password-protecting a directory is a simple way to restrict access to part of your website - useful for staging sites, client preview areas, or any folder you don't want publicly accessible. dotCanada's cPanel makes this easy without any manual configuration required.
Using Directory Privacy in cPanel
- Log in to your cPanel account.
- Go to the Files section and click Directory Privacy.
- Browse to the folder you want to protect and click the Edit button next to it.
- Check the box that says Password protect this directory and enter a name for the protected area (this is what visitors will see in the browser prompt).
- Click Save.
- Scroll down to create a username and password, then click Save again.
From now on, anyone visiting that directory will be prompted to enter the username and password before the content is shown.
How It Works Behind the Scenes
cPanel automatically generates an .htaccess file and a .htpasswd file in the protected directory. The .htpasswd file stores the hashed password and is kept outside the web root for security.
Removing Password Protection
To remove protection, go back to Directory Privacy, select the folder, uncheck the password protection option, and save.
Use Cases
- Protecting staging or development versions of your site
- Restricting access to admin or backend directories
- Sharing work-in-progress with specific clients
If you run into any trouble setting up directory protection, contact our support team and we'll help.
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
