Youtube video to mp3 converter online. htaccess - How to avoid MP3 downloading sites from using my files? - Webmasters Stack Exchange

I have a WordPress site where I'm gonna host files such as MP3s. The thing is I know if I don't do anything, MP3 Crawlers like mp3glu or mp3pleer will come and use my files and bandwidth, which I don't want (it's a free host, and since he's already kind enough to host me, I don't want to cost him too much, you know). Mp3 download sites.

Now I saw that I could use the htaccess file, but... how? I currently have this:

RewriteEngine on #Disallow blank: #RewriteCond %{HTTP_REFERER}!^$ RewriteCond %{HTTP_REFERER} [NC] RewriteRule \.(jpg|jpeg|png|gif|mp3|mp4)$ - [NC,F,L]

Basically, I wanted to try to say that the pensees thing was not here anymore if the referrer was not my website itself ( Though, it doesn't work. I created a random reddit post so my referrer should not be my site and well it works as if i had done nothing (if whatismyreferrer is right, the referrer is empty)

Any idea? I precise that the pensees is not a file nor a directory, it's a wordpress network blog, but doing anything else (with a file for example) does the same.

I would not depend on the referrer.

Free mp3 converter

The easiest way is to make a set of rules with IP addresses you want blacklisted as well as user agents you want blacklisted and if a remote user matches any of the blacklists, then they will receive the not-authorized page. Below is a template you can use. replace the set of three x's with digits for the IP address and the slashes are next to the dots to make them literal. Also, change

to the folder where your MP3's are stored.

RewriteEngine On RewriteCond %{REMOTE_ADDR} [OR] RewriteCond %{REMOTE_ADDR} [OR]... RewriteCond %{REMOTE_ADDR} [OR] RewriteCond %{REMOTE_ADDR} RewriteRule ^/secretmp3folder/(.*)$ - [R=403,L] RewriteCond %{HTTP_USER_AGENT} ^badagent$ [OR] RewriteCond %{HTTP_USER_AGENT} ^terribleagent$ [OR] RewriteCond %{HTTP_USER_AGENT} ^insaneagent$ RewriteRule ^/secretmp3folder/(.*)$ - [R=403,L]

Another thing you can do is when advertising the download, make the link to it a special page that sets a cookie then redirects the user to the download.

Here's an example. (keep in mind I'm excluding common HTTP headers and I'm only showing content within the body tags)

P3 free

The script the links link to:

<?php if (intval($_GET['DOWNLOAD'])!= 1){ $file=$_GET["mp3"]; setcookie("candownload",1,time()+86400,"/",""); header("HTTP/1.1 301 Moved",true); header("Location:".$_GET["mp3"]."&DOWNLOAD=1",true); }else{ if (intval($_COOKIE["candownload"])!= 1){ echo "Access denied"; }else{ header("content-type: application/ms-download",true); header("content-disposition: attachment; filename=".$_GET["mp3"],true); echo file_get_contents("/path/to/".$_GET["mp3"]); } }?>

The script isn't 100% perfect since some things needs tweaking depending on where the MP3 files are on your system. But the idea is when someone clicks a downloadable MP3 file, they are taken to a redirect page and at the same time a cookie is stored on the clients computer to identify them as a client. then after the redirect, the client is validated as a client and the download immediately begins.

To stop hotlinking from any website just add this to your htaccess:

RewriteEngine on RewriteCond %{HTTP_REFERER}!^$ RewriteCond %{HTTP_REFERER}!^http://(www\.)*$ [NC] RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|php|png|css|pdf)$ - [F]

Mmp3 download

UPDATED: It worked well for me when I hosted mp4 files

UPDATED: this is what I used for my website and it seemed to work well. Other websites could not stream my videos at all. This is not just for blocking other websites to use your files. I just want to show where the bit of code you are looking goes.

Options -Indexes +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME}!-f RewriteCond %{REQUEST_FILENAME}!-d RewriteRule ^watch/([^/]+)/? view.php?id=$1 [NC,L] RewriteRule ^([0-9_-]+)/?$ index.php?id=$1 [L] RewriteRule ^([a-z-]+)/?$ search.php?q=$1 [NC,L] RewriteCond %{THE_REQUEST} \ /search(?:\.php|)\?q=([^\ &]+) RewriteRule ^ /%1? [L,R] RewriteCond %{HTTP_REFERER}!^$ RewriteCond %{HTTP_REFERER} [NC] RewriteRule \.(jpg|jpeg|png|mp4)$ - [NC,F,L]

Not the answer you're looking for? Browse other questions tagged htaccess or ask your own question.

Posted by at 01:48PM

Tags: youtube video to mp3 converter online, free no3 download, free online mp3 songs, free mp3 downloads legal, free mp3 music without downloading, soundtrack mp3, listen to music, free mp3 converter, mmp3 download, p3 free

Overall rating page: 3.86/5 left 27572 people.


There are no comments for this post "htaccess - How to avoid MP3 downloading sites from using my files? - Webmasters Stack Exchange". Be the first to comment...

Add Comment