Force a PDF or MP3 to download (without loading in memory)

Just add this line in .htaccess file, and it’ll force PDF file to download rather than opening it on adobe reader.

<FilesMatch “.(?i:(pdf|mp3))$”>
<IfModule mod_headers.c>
ForceType application/octet-stream
Header set Content-Disposition attachment
</IfModule>
</FilesMatch>

Here are the helpful links …

1. http://www.thingy-ma-jig.co.uk/blog/06-08-2007/force-a-pdf-to-download
2. http://www.askapache.com/htaccess/using-http-headers-with-htaccess.html

For Lighttpd … follow this link

Advertisements