views:

8

answers:

1

Ok, I'm not fluent in Apache...

I have a .htaccess file setup like so:

<Files *>
    Order Deny,Allow
    Deny from all
    Allow from localhost
</Files>

RemoveHandler .php .php3 .phtml .cgi .fcgi .pl .fpl .shtml

The Problem is I am needing to use .pdf files to link to a URL like so within this directory:

<iframe name="FRAME2" src="http://docs.google.com/viewer?url=URLTOFILE.pdf&amp;reqTime=1271316295&amp;embedded=true" width="500" height="280" frameborder="1"></iframe>

So the PDF file never gets displayed/embedded as it should within the page. If I remove all lines from the .htaccess file it WORKS PERFECTLY. However, I'm guessing that that is in there for security reasons. So, is there anyway to bypass PDF files only, so that they are allowed from ALL or a way to allow it only for the google URL in here?

Please help...arggg

And before anyone asks, "URLTOFILE.pdf" is actually pointing to a VALID PDF file on my server within the same folder that the .htaccess file is located in.

Thanks :)

A: 
<Files *.PDF>
    Order Allow, Deny
    Allow from all
</Files>


<Files *>
    Order Deny,Allow
    Deny from all
    Allow from localhost
</Files>

These directive apply in the order they are specified. So, first, allow access to PDF files, and then deny everything not caught.

Borealid
No, this is not working, changed my .htaccess file so that it says this and than the `RemoveHandler` code at the end of it all and still not working. Says: "Sorry, we are unable to retrieve the document for viewing." ARGGG! Any other suggestions? Because like I said, if I completely remove all lines of text in the .htaccess file it works fine.
SoLoGHoST
Are you sure you got the case sensitivity right? Look in the Apache request logs to see what was actually requested. It's also possible that the Google Docs viewer is caching something.Test access with a real web browser. If you can read the file directly, the rules are working. It's also possible I got the clause order backwards, and it should be "deny everything, then allow PDF files". I can never remember.
Borealid
Yes, I am testing in a real browser, and am clearing my cache and cookies, and history before testing each time.
SoLoGHoST
Still not working when I change the order of the <Files> tags.
SoLoGHoST
I can't access the apache request logs, using a sub-domain. And like I said, if I remove just the <Files *> Apache Tags, all works fine. But I still can't understand why PDF files don't get displayed unless I remove the <Files> Tags... argg. Can't you just place an ip address or something next to `localhost` to ALLOW something else besides `localhost`. I've tried http://docs.google.com, though doesn't work either.
SoLoGHoST
Your changed code isn't working either, and switched the order around also, and is still not working. Thanks anyways :(
SoLoGHoST