Password-protecting a website folder with cPanel Directory Privacy

Directory Privacy places a browser login in front of a website folder, making it useful for a private preview or restricted document area. It protects web access to the selected folder and its descendants, not FTP, SSH or other server access.

What you need before you begin

Find the correct document root and folder first. Keep a copy of existing .htaccess rules, because application rewrites and access controls share that configuration. Use HTTPS so the browser credentials are protected in transit.

01 Password-protect a website folder with cPanel Directory Privacy

  1. Open Directory Privacy in cPanel, navigate to the required directory and choose its Edit action.
  2. Select Password protect this directory, enter a descriptive label and save the security setting. The label does not rename the folder.
  3. Return to the directory’s configuration and create an authorised username with a strong unique password. Saving protection alone does not create a usable login.
  4. Open the protected HTTPS URL in a private browser session. Confirm it requests credentials, then sign in using the directory user you created.
  5. Test important application paths and automated checks. Password protection can also block payment callbacks, monitoring or certificate-validation paths beneath that folder.

Confirm the intended access works

A fresh unauthenticated session should be challenged, while the authorised user can view the intended content. Check a child directory to understand inherited protection.

What if Directory Privacy causes a loop or I need to make the folder public?

If the site loops or returns an error, review conflicting .htaccess rules and restore the recorded configuration if necessary. Remove access for a departed user from the authorised-user list. To make the folder public again, clear the protection checkbox and save rather than deleting application files.

Sources and further reading

  • 0 Users Found This Useful
  • cpanel-whm, security-ssl
Was this answer helpful?

Related Articles

Blocking an unwanted website visitor with cPanel IP Blocker

IP Blocker restricts website access from an address or range. It is a web access control, not a...

Preventing unwanted image hotlinking with cPanel

Hotlink Protection can restrict other sites from embedding selected files hosted on your...

Diagnosing a legitimate request blocked by ModSecurity in cPanel

ModSecurity is a web application firewall that can block suspicious requests before the...

Enabling two-factor authentication for a cPanel login

cPanel two-factor authentication adds a time-based code to the panel login after the password....

Replacing or removing cPanel two-factor authentication

When changing phones, reconfigure cPanel 2FA so the new authenticator can generate valid codes....