Force Mp3/Mp4 Files To Download Instead Of Streaming Online Via Htaccess

What are the .htaccess commands which force media files like (mp3/mp4) to download instead of streaming online? [Important| Revised 2019]

If you want to have the visitors force download the media files like mp3/mp4 instead of streaming online then this will require a small bit of .htaccess code to be added in your htaccess file. All you need is to add some custom commands in your htaccess file and it will forcefully allow all the Mp3/Mp4 files to download instead of streaming online.

Steps to force download any mp3/mp4 file instead of streaming online: [Updated May 2022]

Allow htaccess To Download Mp3 Files

step::1 Login to your cPanel

step::2 Click on the File Manager section

step::3 Now go public_html and find .htaccess file

step::4 Click on .htaccess file to Edit

best linux hosting provider

In this file, you have to write a code

AddType application/octet-stream .mp3
AddType application/octet-stream .mp4

Best linux hosting provider redserverhost

You can use this, htaccess code to force download any file in any format such as mp3, mp4, pdf, jpg, mov, avi, etc.

The only change you need to make is changing its extensions.

Suppose you want to force download any pdf file so what you need to do is just write this code:

AddType application/octet-stream .pdf

Hope this helps you:-)

Thanks for Reading!!!!

Scroll to Top