Your network is glacial, will load anyway in seconds.

Force File Downloads on Your Site

Today I was browsing some Nigerian websites looking for songs to download (yeah, downloading isn’t illegal in Nigeria), and I happened to notice something. For some reason, every time i hit the download button, I usually end up with the song playing directly on my device without downloading to my sound system. Its annoying.

It also applies to documents like pdf files, where the document starts loading with the browser instead of downloading to my computer.

How to force file download

There is a way you can force the browser to acknowledge that it needs to download (not stream)  the file in question. First, you need to make a few changes to your websites files. This is not going to be easy if you are not a programmer of have some sort of web knowledge.

For clarity purposes, I’ll use the popular cPanel, as a backbone for the screen shots i’ll provide.

Step 1

Log into your website using FTP (File Transfer Protocol). In a lay mans words, log into the part of your website that lists all the file in your domain.  When you have logged in, you should see your list of files.

Now, navigate to your “public_html” folder. This should be the folder where your actual web files reside, your web root if you may. If you’re using cPanel, just log into your cPanel, then click on the “File Manager” link in your cPanel.

Screen Shot 2014-10-23 at 6.35.49 PM

Now make sure you select the following on the pop up that comes after clicking the file manager link. Select “Show Document root for:” then choose the website inquisition from the dropdown field. Also check the “show hidden files” selection, click OK.

Screen Shot 2014-10-23 at 6.37.28 PM

Step 2

Now, look for a file called “.htaccess” in your file list. Select it and click “Edit” on the top tool bar. If you do not have this file, click on “New File” and make a new file called “.htaccess” (without quotes and without a file name, just .htaccess).

In the file add this block of code to the very bottom (make sure its the last thing written at the bottom):

  ForceType application/octet-stream
  Header set Content-Disposition attachment

Now save the file. That’s all. Any files like mp3, mov, mp4, wav, and pdf, will be downloaded directly to the browser instead of opening in the browser. You can add more file types if you feel the need to. Just add a pipe character and the file extension to the end of the list of file extensions. Example, to add direct download for jpeg files, change


Hope this helps someone in the future.

Photo Credit: Leo Hidalgo (@yompyz) via Compfight cc

Thanks for saying hi!

You can also keep tabs on us by liking our social media pages. Thanks.

%d bloggers like this: