Search
 

Set pdf to download for Apache2

On Apache 2, this is all trivially easy. Just place the following in a .htaccess file in the same directory as your PDFs, and you’re done.

SetEnvIf Request_URI "\.pdf$" requested_pdf=pdf

Header add Content-Disposition "attachment" env=requested_pdf

This requires mod_headers, which is shipped with Apache2. On Ubuntu, it needs to be enabled with the “a2enmod headers” command.

Comments are closed.

Testimonials

“I’ve received A LOT of great feedback from my colleagues about the site. So thank you.”
Peter, www.saintpetersblog.com

Online Payment Portal

Use this portal to make a payment toward your services via PayPal.