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

One Response to “Force a PDF or MP3 to download (without loading in memory)”


Share your thoughts & feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: