cancel
Showing results for 
Search instead for 
Did you mean: 
Go to solution

Have a direct download link

Hello, please🙏

Is it possible to have direct download links on WordPress? I know how to add images, for example a Mp3, with a link. But when the visitor clicks the links I have created, they view it directly in the browser. Then they have to download it from there. I was wondering if it’s possible to create a link that just starts downloading a file instantly to the visitor’s computer when they click it? Without going through the extra step of viewing it first.

Thank you 😊
6 REPLIES 6
Super User II
Super User II

Re: Have a direct download link

@At9aija 

 

In your .htaccess file you would need to add lines like

 

AddType application/octet-stream .csv
AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf

Depending on the type of file you are working with  - this should force the file to download vs opening

GoDaddy Pro User - Managing over 300 WP Sites

Re: Have a direct download link

Thank you for the replay,
I try adding the code, but still it doesn't work.
Please provide me the code that work for MP3 and VIDEO.

Thank you
Super User II
Super User II

Re: Have a direct download link

Can you give me a link to your site so I can see what happens

GoDaddy Pro User - Managing over 300 WP Sites

Re: Have a direct download link

http://at9aija.com.ng

Or

Click DOWNLOAD Mp³ on this page➡ http://at9aija.com.ng/dj-ab-kumatu/

Thank you!❤
Super User II
Super User II
Solution

Re: Have a direct download link

@At9aija 

 

So you added this to the htaccess file

AddType application/octet-stream .mp3

You can also try

<FilesMatch "\.(?i:doc|pdf|mp3)$">
  Header set Content-Disposition attachment
</FilesMatch>

You may have to put an .htaccess file in the uploads folder where you have the MP3 file

GoDaddy Pro User - Managing over 300 WP Sites

Re: Have a direct download link

Thank you very much,
I'm much grateful.
My problem has been resolved
Thanks to RESOLVER IV.

Please do mail me privately i have something to discuss [removed]
I hope to hear from you sir🙏


One love❤