Tekforums

Chat => Entertainment & Technology => Topic started by: Faulky on July 13, 2006, 15:40:50 PM

Title: .htaccess & PDF
Post by: Faulky on July 13, 2006, 15:40:50 PM
I asked about password protection a little while ago, and was directed to .htaccess. Got that sorted. But it doesnt password protect PDF files, which is what I really need. Can .htaccess protect PDFs, or not. If not, any ideas what I could do to secure them?

Cheers, Jonathan.
Title: Re:.htaccess & PDF
Post by: Faulky on July 13, 2006, 16:04:50 PM
I think Ive got a lead...

If I put a PDF file in the SAME dir as my .htaccess file, it works. But, if I put the PDF within a sub-directory, it doesnt. Which is odd, because it says here (http://www.freewebmasterhelp.com/tutorials/htaccess/3) that everything below this directory [the dir with .htaccess file in it] will be password protected.

Anyone got any ideas why it isnt working?

Ta, Jonathan.
Title: Re:.htaccess & PDF
Post by: BigSoy on July 13, 2006, 16:48:31 PM
Does your host automatically create a vanilla .htaccess file in any sub-directories you create? If so that might be your problem.

AFAIK unless you specify otherwise, .htaccess properties apply to all contents of a directory regardless of file-type.
Title: Re:.htaccess & PDF
Post by: Faulky on July 13, 2006, 17:27:48 PM
Thats what I thought. But it doesnt seem to be the case.

The host doesnt seem to put any .htaccess files in the subdirs.

:(
Title: Re:.htaccess & PDF
Post by: TRB on July 13, 2006, 19:32:16 PM
What you are experiencing the default behaviour.  You need to turn off .htaccess checking for subdirs with an allowoverride directive.

http://httpd.apache.org/docs/1.3/mod/core.html#allowoverride
Title: Re:.htaccess & PDF
Post by: Faulky on July 24, 2006, 16:55:50 PM
Thanks, TRB. Im not sure I fully understand, though.

I can see that AllowOverride allows the .htaccess file to override anything set my the server (my host), but what would I need to insert into my .htaccess file in order for it to override any settings and so alllow password protection of sub-directories?

Just "AllowOverride", or "AllowOverride All", or something else?

Thanks a lot.