Mod rewrite "distorts" PDF files in secure dir.

Fix it!!

Postby hagai » Thu Aug 30, 2001 5:02 am

I have a weird problem that doesn't make sense to me.

My .htaccess file look like this;

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://w**$
RewriteRule ^.*$ [R]

Simply put, if you try to access a file outside of my page you will be redirected.

Now the problem occurs when I try to view a pdf file in this directory. The error I get from acrobat is "File does not begin with '%PDF-'". However it in fact does start with '%PDF-' and when I remove the .htaccess file I am able to view the pdf file. Text files are not affected by the .htaccess file.

Does anyone know if this is an Acrobat issue or a web hosting issue?
Can anyone check if this happens to them? I dont have access to another server so i cant check myself.
Any way to get around it without removing the .htaccess file, that's a security measure I can't live without?
Why would this even affect any files???

btw im useing M$IE and adobe acrobat. Netscape has no problems with this issue.

Thanks for your help

Posts: 1
Joined: Wed Aug 29, 2001 4:00 pm

Postby Brett » Thu Aug 30, 2001 3:11 pm

I have no idea what would cause this behavior. Try using Web Sniffer to see what headers are being generated (with and without mod_rewrite directives). This might give some clues.
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm

Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 2 guests