How to Password-Protect a Folder on Your Website

Require a username and password to view part of your site.

← Help Center

Directory Privacy adds a login prompt to any folder on your site — useful for a staging site, private downloads or an internal area.

Protect a folder

  1. Log in to cPanel and open Files → Directory Privacy.
  2. Browse to the folder you want to protect and click Edit next to it.
  3. Tick Password protect this directory, give the area a name (shown on the login prompt), and click Save.
  4. Under Create User, add a username and password, then click Save.

Visitors to that folder now need to log in. Add as many users as you like.

Tip: Protecting a folder also protects everything inside it. Avoid protecting public_html itself unless you want your whole site private.

Related articles

Still need a hand?

Our team is available 24/7. Submit a support ticket or call 877.821.HOST and we’ll walk you through it — or do it for you.