For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

  1. Open your website dashboard.

  2. Go to AdvancedPassword Protect Directories.

  3. Pick or enter the directory to protect.

  4. Set a username and password.

  5. 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 AdvancedPassword Protect Directories and remove the directory from the list.

  • Via .htaccess: Remove the AuthType, AuthName, AuthUserFile, and Require lines.


Last updated: July 22, 2026

Last updated

Was this helpful?