In cPanel, open Directory Privacy in the Files section, click Edit beside the folder and tick 'Password protect this directory'. Name the protected area and click Save. Access also needs a user, created with a username and password in the Create User section of Directory Privacy. Anyone opening the folder in a browser must then enter those credentials to see its contents.
Directory password protection adds an authentication layer before visitors can access specific folders on your site. This prevents unauthorised access to sensitive areas like WordPress admin pages, staging environments or client documents.
You will configure password protection through cPanel’s Directory Privacy tool, create user credentials and verify the protection is active. Once complete, anyone attempting to access the protected directory must enter valid credentials before viewing its contents.
You will navigate to the directory you want to protect and enable password authentication. This creates the initial protection layer before adding user credentials.



You will now create user accounts that can access the protected directory. Each user receives unique credentials for authentication.


Your directory now requires authentication before visitors can access its contents. You enabled password protection through cPanel’s Directory Privacy tool and created user credentials for authorised access. Anyone attempting to view the protected directory must enter valid credentials first.
Consider combining directory protection with hotlink protection to prevent unauthorised embedding of your files. For WordPress sites, review our guide on WordPress security plugins for additional protection layers. Our cPanel hosting includes all the tools you need to secure sensitive directories.
If you run into any trouble, get in touch and our team will be happy to help.
Did this guide solve your problem?
Our UK support team answers tickets and live chat every day. Send us the guide you were following and where it stopped working.
Related guides
cPanel hosting with the tools these guides use, backed by UK support.
Get cPanel HostingProtect your visitors with SSL certificates – from budget DV to premium EV certificates.
Get SSL Certificate