Support article
Protect a directory with a password in hosting
Learn how to restrict access to a folder on your website with a username and password from DirectAdmin or cPanel.
Introduction
Protecting a folder with a username and password is a simple way to restrict access to a specific area of your website.
It can be useful for a private folder, a staging area, internal documents or any content that should not be publicly visible.
How this protection works
When you enable it, the browser asks for credentials before showing the contents of that directory.
Only people who know the username and password can enter.
How to protect a folder
1. Log in to your hosting panel
Access DirectAdmin or cPanel from your client area.
2. Find the security tool
Depending on the panel, it may appear as:
Password Protected DirectoriesDirectory Privacy- Similar translated names
3. Select the correct folder
Choose only the directory you really want to protect.
For example:
public_html/private
4. Enable the protection
Activate the option and, if requested, add a descriptive label for the protected area.
5. Create the username and password
Use strong credentials that are different from your hosting panel password.
6. Test access
Open the folder URL in the browser and confirm that the authentication window appears.
Useful tips
- Do not protect all of
public_htmlby mistake. - Use HTTPS.
- Create separate users if multiple people need access.
- Keep backups before important changes.
Frequently asked questions
Can I protect only one specific folder
Yes. You do not need to block the whole website.
Does this affect email
No. It only affects web access to the selected directory.
Can I remove the protection later
Yes. You can disable it later from the same panel.
Conclusion
Protecting a directory with a password is a simple and useful way to control access to certain folders inside your hosting account.
If you choose the right path, use strong credentials and test the result, you can create a functional private area in just a few steps.