Apache: How to force download a file using .htaccess ?

I have some videos that i want other people to download it instead of playing it on the browsers.

First, i just try to upload that file to my web document folder and share the link, i found that the user can watch the video directly, this is not what i want, i want the user to download it to their computer, then watch it from their computer later. I did some research and i found that there is a very easy way to accomplish, you just need add the following like to .htaccess file

AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .mp4

This applies to Apache Server , tested on Linux Ubuntu. As usual, you can share if you think it’s useful.

Leave a Reply

Your email address will not be published. Required fields are marked *