2

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?

MrWhite
  • 11,643
  • 4
  • 25
  • 40
Wungiel
  • 21
  • 1

1 Answers1

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:

MrWhite
  • 11,643
  • 4
  • 25
  • 40