Your Time:
Our Time:
← Back to discussions

Any way to prevent mp3 downloads?

Need help with a different issue? Search the forums or open a new ticket.
Open a support ticket

This topic has 5 replies, 2 voices, and was last updated 10 years, 7 months ago by Anonymous.

  • 2016-01-08 at 8:25 am
    Support Expired
    #12076
    seth2958
    Participant
    • Topics: 10
    • Replies: 16
    • Total posts: 26
    • Post count: 22

    Is there any way to prevent mp3 downloads from album play lists? Thanks for any advice.

    2016-01-08 at 10:46 am
    #12087
    Anonymous
    Inactive
    • Topics: 0
    • Replies: 3227
    • Total posts: 3227
    • Post count: 0

    To prevent mp3 downloads, you have to uncheck “Add To Download” checkbox and don’t provide “Download Link” as shown in the screenshot.

    2016-01-09 at 4:22 am
    Support Expired
    #12109
    seth2958
    Participant
    • Topics: 10
    • Replies: 16
    • Total posts: 26
    • Post count: 22

    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.

    2016-01-11 at 10:42 am
    #12133
    Anonymous
    Inactive
    • Topics: 0
    • Replies: 3227
    • Total posts: 3227
    • Post count: 0

    Thanks for sharing!

    2016-01-18 at 3:06 am
    Support Expired
    #12232
    seth2958
    Participant
    • Topics: 10
    • Replies: 16
    • Total posts: 26
    • Post count: 22

    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.

    • This reply was modified 10 years, 7 months ago by seth2958.
    • This reply was modified 10 years, 7 months ago by seth2958.
    2016-01-21 at 11:36 am
    #12346
    Anonymous
    Inactive
    • Topics: 0
    • Replies: 3227
    • Total posts: 3227
    • Post count: 0

    Thanks for sharing!

You must be logged in to reply to this topic.