0


.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.+)\.pdf$  viewer.php?pdf=$1 [L,NC,QSA]


This works well with firefox however chrome chooses to open the pdf in its own in browser embed/displayer. How can I make this work with chrome?

Thanks

user1530249
  • 1,047
  • 3
  • 19
  • 28

1 Answers1

0

Instead of using .htaccess to set the mime type, it works better when you use your viewer.php to set the appropriate headers that should work as you want in all browsers.

See the first answer here

Community
  • 1
  • 1
Wouter
  • 833
  • 6
  • 13
  • Hi, thank you for the answer. However, the problem is I am using wordpress so I cannot just add a prefix before pdf links. Is there a work around? – user1530249 Jul 25 '12 at 22:16
  • You can keep redirecting urls ending in .pdf to viewer.php, exactly like you are doing now. In viewer.php you should just add more http headers to force browsers to download the file instead of opening it in the browser window. The link in my original answer should give you a good start, since it addresses the same problem you have. – Wouter Jul 25 '12 at 22:23