How to password-protect a folder

Directory Privacy lets you put a username and password in front of any folder on your site — handy for staging areas or private files.

Protect a directory

  1. Log in to cPanel and, under Files, click Directory Privacy.
  2. Browse to and select the folder you want to protect.
  3. Tick Password protect this directory, give it a label, and save.
  4. Create a user and password for access on the same screen.

How it works

Anyone visiting that folder now sees a browser login prompt and must enter the username and password you set. You can add several users, and remove protection anytime by unticking the box.

Want to protect your whole site temporarily (for example while building it)? Ask us and we'll point you the right way.

Was this answer helpful?

 Print this Article

Also Read

How to block an IP address

If a particular visitor or bot is causing trouble — spam, scraping or attacks — you can block...

How to enable hotlink protection

Hotlinking is when another website embeds your images directly, using your bandwidth to display...

How to increase your PHP memory or upload limit

Hitting upload exceeds maximum or memory exhausted errors? You can raise PHP's limits from...

How to set up a redirect

Redirects send visitors from one URL to another — useful when you move a page, change its name,...

How to change your PHP version

Different apps need different PHP versions. You can switch your account's PHP version in cPanel...