coderex
coderex

Reputation: 27855

download page/folder privacy with .htaccess?

I have a private folder on my domain like

http://example.com/protected

and i stored lot of images and pdf file there

 /protected/pad1.pdf
 /protected/pad2.pdf
 /protected/pad1.png
 /protected/pad1.png

supose these are the files, how can i hide or protect access to there files with the help of .htaccess file.

allow only users those who knows the password.

is it possible ???

Upvotes: 0

Views: 159

Answers (2)

Alix Axel
Alix Axel

Reputation: 154543

Or for zero configuration and zero access:

Order Allow, Deny
Deny From All

=)

Upvotes: 1

You
You

Reputation: 23774

Check out Apache's page on Authentication, Authorization and Access Control -- one method would be using Basic or Digest authentication. That would look something like this:

AuthType Digest
AuthName "Private files"
AuthDigestFile /usr/local/apache/passwd/digest
Require user (usernames here)

Of course, you need to generate a password and/or digest file using htdigest or htpasswd as well, but that procedure is explained in the document I linked to.

Upvotes: 5

Related Questions