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?
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:
However, the
.htpasswd
file should be at a location outside of theDocumentRoot
(outside of the public HTML space). It shouldn't be in the directory you are trying to protect.Reference: