Sometime you don't want to give your site visitors the option to open a file in their web browser. This could be a Microsoft Office document, or even a giant jpg or png image. When you want to force download a certain file type, simply add something like this to an .htaccess file in the directory that the file(s) are located in:
<Files *.xls> ForceType application/octet-stream Header set Content-Disposition attachment </Files> <Files *.eps> ForceType application/octet-stream Header set Content-Disposition attachment </Files>
This particular directive forces downloads all .xls and .eps files (the * means match any file name, followed by the extension of the file) in the same directory, as well as any sub-directories, and ensures that the browser will not try to open the file.
In general, I like to avoid putting such things in my root .htacess file, preferring to create a "downloads" directory of some sort, and just adding the above lines as needed. Some servers are different, so your mileage may vary - check the comments below.

By Sedikit Trik .htaccess | Rusydi Blog November 24, 2011 - 5:01 am
[...] Source: http://www.givegoodweb.com/post/30/forcing-a-download-w?th-apache-?n?-htaccess [...]
By 30+ Popular .htaccess code snippets November 11, 2011 - 3:45 am
[...] http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess [...]
By Most useful .htaccess snippets to have in your toolbox - Web Developer Geeks - Web Developer Geeks October 24, 2011 - 3:26 am
[...] Force download of specific files [...]
By 10 useful .htaccess snippets to have in your toolbox | Tutorial Scribe October 10, 2011 - 8:46 am
[...] Source: http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess [...]
By just-euphoria September 6, 2011 - 9:39 pm
wow.. thx for the info…
great…. it’s work.
thx
By » 10 useful .htaccess snippets to have in your toolboxIT Mix UP: Active IT Blender September 2, 2011 - 1:35 am
[...] Source: http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess [...]
By 10 códigos útiles .htaccess que como programador debemos tener en nuestra caja de herramientas Parte 2 | Blog de Desarrollo | Por Celestino Estrada July 28, 2011 - 1:52 pm
[...] http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess Tagged: .htaccess, [...]
By Ultimate htaccess tweak for Speed and Security | WPBuff | For Wordpress Installation, Configuration, Hardening and Optimization | Wordpress Themes, WordPress Plugins, Wordpress Hosting, Wordpress Tweaks, Wordpress Hardening, Fonts, Webfonsts, Favicons, Ve July 12, 2011 - 3:04 pm
[...] Source: http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccess [...]
By Forçando o download de arquivos no Apache com .htaccess - DEV DB June 21, 2011 - 6:35 am
[...] Forcing a download with Apache and .htaccess [...]
By 10 Useful .htaccess Snippets - Alexa Web DesignAlexa Web Design June 9, 2011 - 3:23 am
[...] Source: http://www.givegoodweb.com/post/30/forcing-a-download-wіth-apache-аnԁ-htaccess [...]
By 10 useful .htaccess snippets to have in your toolbox | CatsWhoCode.com June 3, 2011 - 3:37 am
[...] ForceType application/octet-stream Header set Content-Disposition attachment </Files> Source: http://www.givegoodweb.com/post/30/forcing-a-download-with-apache-and-htaccessLog PHP errorsThis snippet is an interesting way to log errors from your php file into a log file. [...]
By Awesome Ness May 5, 2011 - 3:43 pm
This works great
By Víctor December 30, 2010 - 5:02 am
Actually, you could skip the ForceType part altogether. The Header set Content-Disposition attachment directive already tells the browser to download the file.
By using ForceType you will also prevent the browser from knowing what kind of file it is (such as application/pdf, application/msword or image/jpeg). It will ensure the client won’t try to display anything, but it’s a bit of an overkill.
By zantor May 6, 2010 - 6:39 am
You need to:
LoadModule headers_module modules/mod_headers.so
ForceType application/octet-stream
Header set Content-Disposition attachment
Works fine.
By Joey Marchy February 12, 2009 - 11:40 am
For those Expression Engine users out there, this did not work for me until I moved the rules into the .htaccess file in the root.
Placing an .htaccess file in the folder that contained the images was not effective.
By Andy November 28, 2008 - 8:46 am
Broke our server with a 500 error.
Removing the Header set line stopped it.