This topic has 5 replies, 2 voices, and was last updated 10 years, 7 months ago by Anonymous.
Viewing 6 posts - 1 through 6 (of 6 total)
To prevent mp3 downloads, you have to uncheck “Add To Download” checkbox and don’t provide “Download Link” as shown in the screenshot.
Thanks, I was actually referring to preventing hotlinking. I found a solution elsewhere that I can share:
Place an .htaccess file in your wp-content directory with the following:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourwebsite\.com/ [NC]
RewriteCond %{REQUEST_URI} !hotlink\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov) [NC]
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule .*\.(gif|png|jpg|doc|xls|pdf|html|htm|xlsx|docx|mp4|mov)$ http://yourwebsite.com/ [NC]
The logic will redirect the file request back to the second URL specified.
Thanks for sharing!
There is a better way to do this, and I wanted to share. It is done by using base64_encode();
For example, on line 244 of single-albums.php, you can do this:
<a class="fap-single-track no-ajaxy" data-id="<?php echo $attachment->ID;?>" data-enqueue="no" data-meta="#single-player-meta" href="<?php echo base64_encode($attachment->guid);?>" title="<?php echo $attachment_title; ?>" rel="<?php echo $imagesrc[0]; ?>"><i class="ivaplay"></i></a>
The function will encode the string, hide the real filepath, and prevent downloads from right-click ‘Save Link As.’ The base64_encode() function can be used anywhere this encoding is desired.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.