News:

Tekforums.net - The improved home of Tekforums! :D

Main Menu

.htaccess & PDF

Started by Faulky, July 13, 2006, 15:40:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Faulky

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.

Faulky

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.

BigSoy

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.
"Within your 'purview'? Where do you think you are, some f**king regency costume drama? This is a government department, not some f**king Jane f**king Austen novel!"

Faulky

Thats what I thought. But it doesnt seem to be the case.

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

:(

TRB

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

Faulky

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.