1

I have .htaccess and .htpasswd files in the directory that has png files that I want to protect.

.htaccess

  AuthType Basic
  AuthName "Co to za nielegalne grzebanie w plikach, juz dzwonie na milicje."
  AuthUserFile ./.htpasswd
  Require valid-user

.htpasswd

test:$apr1$hp25fckm$QSSnnAWn6b5lWDScZ7h7t0

and I don't know why it's not working?

2
  • Where is the .htpasswd file? Mar 10 at 20:24
  • Are you really on Apache 2.2?
    – MrWhite
    Mar 10 at 20:53
1
AuthUserFile ./.htpasswd

The file-path to your password file is most certainly wrong. This should be an absolute filesystem path. (Or a relative path, relative to the ServerRoot).

For example, depending on the file-path to your document root, this should be something like the following instead:

AuthUserFile /www/user/public_html/images/.htpasswd

However, the .htpasswd file should be at a location outside of the DocumentRoot (outside of the public HTML space). It shouldn't be in the directory you are trying to protect.

Reference:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.