Marc Blase

Force (some) MIME types to download

OK, so technology is hard for some people. Really it is. So, I think we should make things easier on them by forcing certain MIME types to download to their computer. I know, you’re probably about to say, “but what about tablets and smart phones?” Well, we’re talking about simplification here and if these people even thought about that, their brains would explode. So, here’s the goods. Fire up your trusty text editor and add this to your site’s .htaccess file:

<filesmatch "\.(?i:doc|odf|pdf|rtf|txt)$">
      ForceType application/octet-stream
      Header set Content-Disposition attachment
</filesmatch>
Published on March 30, 2012