How to force file download via .htaccess
I haven’t added anything new to this blog for a while, but today I stumbled on a really useful trick that allows you to force a file download of specific file types via .htaccess. More after the break.
Let’s say you want to provide some registry files (.reg) on your website or some videos and MP3′s that users should only download not watch on your server, then this will come in handy.
Create a .htaccess file in your download folder e.g. /downloads/ and then copy and paste this
<Files *.*> ForceType applicaton/octet-stream </Files>
This will force the browser (IE, Firefox, etc. all supported) to download the file instead of trying to open it!
I hope this helps some people, because it clearly sucks when people can’t download your files and you did not notice it.
Like our posts? Then subscribe via Mail:










Leave your response!