Iter Ator
Iter Ator

Reputation: 9334

Protect only a directory with htpasswd

I would like to protect the protect-me-dir directory with http password. I tried this code:

AuthType Basic
AuthName "restricted area"
AuthUserFile /home/iterator/public_html/protect-me-dir/.htpasswd
require valid-user

It works, but unfortunately it asks for the password everywhere, not just in protect-me-dir. How is it possible to protect only that directory?

If I put this code inside <Directory "/home/iterator/public_html/protect-me-dir">...</Directory>, I get Internal Server Error

Upvotes: 0

Views: 474

Answers (1)

P Varga
P Varga

Reputation: 20269

Just put the .htaccess file in the directory you want to password-protect. It is a per-directory config file.

Upvotes: 1

Related Questions