How to Instruct Browser to Download Media Files Instead of Display Them Using htaccess file

Home / Website Design and Management / htaccess file / How to Instruct Browser to Download Media Files Instead of Display Them Using htaccess file

Here is a useful method for delivering multimedia file downloads to your users. Typically, browsers will attempt to play or stream such files when direct links are clicked. With this method, provide a link to a multimedia file and a dialogue box will provide users the choice of saving the file or opening it. Here are a few htaccess rules demonstrating the technique (edit file types according to your specific needs):

AddType application/octet-stream .zip .mp3 .mp4 .avi .mpg .wmv

This tells the Apache Web Server to treat .zip, .mp3,  .mp4, .avi, .mpg, .wmv files as downloadable, and should be used instead of specifying them as audio/video/zip files in your MIME types section.

Leave a Reply

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