Password-Protected Directories
Require a username and password for specific website directories using hPanel's Password Protect Directories tool on Hostinger or .htaccess and .htpasswd.
Require a username and password to access specific directories. Visitors see a browser prompt before they can view the content.
Common uses:
Development or staging sites
Admin or internal areas
Client preview pages
Set up in hPanel
Open your website dashboard.
Go to Advanced → Password Protect Directories.
Pick or enter the directory to protect.
Set a username and password.
Click Protect.
Visitors now see an auth prompt on that directory.
Manage protected directories
All protected directories are listed in the panel. You can:
Add more users to a directory
Change a user's password
Remove protection
Via .htaccess
1. Create .htpasswd
Store usernames and hashed passwords. Put it outside public_html (e.g., /home/username/.htpasswd).
2. Add .htaccess
In the directory you want to protect:
Replace /home/username/.htpasswd with your actual path.
Remove protection
In hPanel: Go to Advanced → Password Protect Directories and remove the directory from the list.
Via
.htaccess: Remove theAuthType,AuthName,AuthUserFile, andRequirelines.
Last updated: July 22, 2026
Last updated
Was this helpful?