How To Force Files to Download In WordPress With 1 Click

By Stermy 5 Min Read
How To Force Files to Download In Wordpress With 1 Click

Townflex Tech News – In this post, we are about to show you guys to simply force download media files from WordPress sites without stress.

This very post by us is targetting bloggers, website owners, and also blog owners who usually run downloadable websites, especially bloggers who set up music download websites who have been struggling and always looking for a download plugin to be able to make music files downloadable on their blogs.

Townflex.com is here to tell you guys we have the best and easiest way to help you all put an end to all the hustle/stress, you will be able to force download all media files you insert on your websites/blog pages.

We're now on WhatsApp. Click here to join.

By just placing/embedding the link of the media file to be downloaded in the post, you will be giving your users a stress-free option to easily download files by just a single click on the embedded link.

This isn’t something hard, you do not have to be a web developer or you do not have to contact a technical guy to handle this for you.

The only thing you need is to make sure you have access to the root folder of your WordPress website installation, using the Cpanel to access the Root folder so you will be able to edit the ht.access file.

We will be showing you the proceedings in the steps below so you can be able to allow your visitors to download media files from your websites without having to load your sites with more plugins which may turn out to slow down your websites.

All you need is to edit your Ht.access file in the root folder and place in a simple piece of code.

Force Download Media Files From WordPress Sites

  1. Login to your website’s Cpanel
  2. Select File Manager
  3. Select Public_Html
  4. Now Select Ht.access
  5. Right-click and edit the file
  6. Add this text <FilesMatch “\.(?i:doc|pdf|mp3|mp4|mov|avi|exe|doc|docx)$”>
    Header set Content-Disposition attachment 
    </FilesMatch>
  7. Now Cick Save File
  8. Done

 

  1. Login to your website’s Cpanel

Here you will enter the link to your cpanel, type in your username and then your password which you will now click on login to head to the next page, the dashboard of your account.

Login to your website's Cpanel
Login to your website’s Cpanel

2. Select File Manager

Now after logging into your Cpanel from the previous stage one, you will scroll till you see a folder named files where under it you will find ‘File manager‘ and then click on it.

file manager
Select File Manager

3 & 4 Select Public_Html

This covers the above-mentioned steps 3 & 4,  in the screenshot below after clicking on the file manager, you are sent to the root folder which is usually the Public_Html folder, click on it and check in the right panel, you will see a file names Ht.access.

Right Click on the Ht.access file and then click on edit which will be sending you the next screen where you will be able to edit the file.

3 Public Html
Select Public_Html

5. Right-click and edit the file

Well after click on the ht.access file, it is time to edit it, copy the text file shared above in step 6, and then paste in inside of the editor as shown in the screenshot below, after that is done, click on save shown at the right corner of the editor as shown in the below screenshot.

4 edit
Right-click and edit the file

That is all, you are all set, now add the link to a media file eg. a link to a music or pdf file uploaded to your media library into the post, your users will be able to download the file by just clicking on the link you added.

Also Read: Best PHP-FPM Settings for Better Optimization

Related Search

download file instead of opening in browser javascript
wordpress download file programmatically
wordpress force download pdf
download file instead of opening in browser chrome
download file instead of opening in browser html
force download link
download button in wordpress
Force Download files In WordPress

Share This Article
By Stermy
Follow:
Stermy is one Crazy fan of the word "Internet". Always online to stay informed and keep others updated. #townflex
?>