Dedicated Download Directory
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.


Reader Comments
2 responses so far
1Oliver July 19th, 2007 at 7:24 pm
2Alan July 19th, 2007 at 7:54 pm
Leave a commentSorry, but this is completely the wrong way to go about this. Good thought though ;)
You should be using “content-disposition“ as an “attachment“. Though I have no idea how to make Apache in particular do this, I am sure Google does. With what you’re doing, all you’re doing is telling the browser that the file type has a “mimetype“ which it sholdn’t. ;)
I’m not taking the credit/blame for making this, that was down to a dodgy forum :P
I guess it works - Is it something to do with cross browser compatibility that i need to use content-disposition then?