Dedicated Download Directory

Published 14/07/2007 at 5:45 PM, updated 30/09/2007 at 5:03 PM (GMT)

I've been trying to find the answer to this for weeks now so I can apply it to my "download.alanedwardes.com" subdomain. Basically, what I wanted to do was to force Apache to make the user's browser offer any file on the server as a download, instead of just opening it in Quicktime or Adobe Reader, which is totally annoying.

I found this interesting post in a forum on the 9th page of results on Google, so I thought I would shed some light on it for others who want to achieve the same result as me.

To force the browser to download any file in the given directory, (applies to subdirectories too) just add the following lines to your .htaccess file:

<Files *.*>
ForceType application/octet-stream
</Files>

It does the job perfectly. Very useful piece of code.

Add a Comment

Comment (No HTML, URIs are automagically made clickable)