PDA

View Full Version : Protect Files w/t Passwords



Darin
August 1st, 2001, 23:14
I have a question: Is it possible to protect certain files in a folder by requiring a user to enter a username/password to view them?

lucifer
August 2nd, 2001, 04:23
if it's apache use .htaccess

meow
August 2nd, 2001, 04:44
If it's not -eat it. :cool:
;)

LastActionHero
August 2nd, 2001, 04:53
Originally posted by lucifer
if it's apache use .htaccess

How? I thought only the whole directory can be protected not individual files?

meow
August 2nd, 2001, 05:18
Move the files to a protected directory? :):rolleyes:

lucifer
August 2nd, 2001, 05:22
you can allow/deny individual files I believe but pu55cats approach is easier

meow
August 2nd, 2001, 05:38
Do you have that line, please? I've been searching an hour and had decided I remebered wrong or mixed it up with redirection. :o

LastActionHero
August 2nd, 2001, 05:42
Originally posted by Darin
I have a question: Is it possible to protect certain files in a folder by requiring a user to enter a username/password to view them?



Originally posted by Meow
Move the files to a protected directory

:rolleyes:

meow
August 2nd, 2001, 05:49
:rolleyes:
1. Make a new directory somewhere
2. Drop your .htaccess in it
3. Move the files you want to be protected
4. Fix your links

lucifer
August 2nd, 2001, 05:55
Originally posted by meow
Do you have that line, please? I've been searching an hour and had decided I remebered wrong or mixed it up with redirection. :o I'm sure you can but I had a quick look and couldn't see it so I gave up.

WorldWarGeneral
August 2nd, 2001, 08:49
Setup your .htaccess file like this:

AuthName "Realm Name""
AuthType Basic
AuthUserFile /.htpasswd
Allow From All
<Files file.xxx>
Deny From All
</Files>

This would password protect file.xxx only.


That came from the users.f2s.com tutorial on .htaccess. http://www.users.f2s.com/faq/htaccess.php3

meow
August 2nd, 2001, 09:01
~~~:):)~~~
Thanks!
Crap, they have added to the tutorial. It used to be thin so I didn't check there. If my vague reminiscence is right, you should be able to have a master .htaccess in the root and protect files deeper down with it.
ultra coolness :cool:

meow
August 2nd, 2001, 09:18
Some one had posted this coment at users:
--------------------------------------------------------
spengster -- Thursday, May 24 2001, 20:15
If you want to protect a single file and still have access to it with the correct username/password from the .htpasswd file, change

Deny From All

to

require valid-user

otherwise, everyone will be denied access and you will not even get a username/password prompt
-------------------------------------------------------