Author Topic: .htaccess & PDF  (Read 1737 times)

.htaccess & PDF
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.

Re:.htaccess & PDF
Reply #1 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.

  • Offline BigSoy

  • Posts: 1,353
  • Hero Member
  • They sicken of the calm, who knew the storm.
Re:.htaccess & PDF
Reply #2 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.
"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!"

Re:.htaccess & PDF
Reply #3 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.

:(

  • Offline TRB

  • Posts: 63
  • Jr. Member
Re:.htaccess & PDF
Reply #4 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

Re:.htaccess & PDF
Reply #5 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.

0 Members and 1 Guest are viewing this topic.