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.
IN THIS ARTICLE
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
- Open Directory Privacy in cPanel, navigate to the required directory and choose its Edit action.
- Select Password protect this directory, enter a descriptive label and save the security setting. The label does not rename the folder.
- 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.
- Open the protected HTTPS URL in a private browser session. Confirm it requests credentials, then sign in using the directory user you created.
- 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.