stop hotlinking of mp3 files from abmp3 and beemp3 .htaccess

Php, Divx, Apache, phpBB
Forum rules
Do not post any code that circumvents rules of any server. You are responsible for anything you use here.
Post Reply
darknkreepy3#
Site Admin
Posts: 253
Joined: Tue Oct 27, 2009 9:33 pm

stop hotlinking of mp3 files from abmp3 and beemp3 .htaccess

Post by darknkreepy3# »

I noticed that through my google webmaster tools that two websites were stealing traffic and the mp3 data off of my website. They were forgotten a long time ago and there as a streaming test, so I wanted this leeching to stop.

writing .htaccess files in windows http://www.techpavan.com/2009/01/16/cre ... s-windows/

You can make an .htaccess file with a text editor and use the following commands to stop these two companies and others from stealing your files and bandwidth:

Code: Select all

<Files *>
Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0"
Header set Expires: 0
Header set Pragma: no-cache
</Files>
AddDefaultCharset utf-8

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !http://(www.)?supercala.net/.*$ [NC]
RewriteRule \.(avi|mp3|js|css)$ - [F]

RewriteCond %{HTTP_REFERER} abmp3\.com [NC,OR]
RewriteCond %{HTTP_REFERER} beemp3\.com
RewriteRule .* - [F]
A backslash is used to let apache understand that you don't mean 'wildcard' with a period. Regular expressions with apache use a period for that, so escaping it with a backslash connotates a period once again.

remember to replace supercala.net with your website name, abc.com, myportfolio.com, videoart2011.com, etc, whatever it is. You can also add new lines of blocking for each site you find out that is stealing your data with this line repeated and changed:

Code: Select all

RewriteCond %{HTTP_REFERER} beemp3\.com
the line above it with [NC,OR] means pay attention to all rules, except the last. You need only to modify the address on this line, and add additional lines for each site you find that is stealing data.

The rewrite rule allows you to block file types from being stolen from new, unknown sites that you haven't tracked yet. If you like to post on social networking sites, don't block [jpg] for instance, then you couldn't hotlink your image to share. photography sites for entertainment would probably want to block sub folders, but keep a few open to share to get people interested in the site itself.

The first set of code lines allows shared servers to instantly show differences as you are programming your site instead of waiting for the cache to refresh every 5-30 minutes, making tweaking a website and seeing the changes very confusing. For the best speed, you should take these lines out if you have a non-changing site (which isn't good, the web likes to change):

Code: Select all

<Files *>
Header set Cache-Control: "private, pre-check=0, post-check=0, max-age=0"
Header set Expires: 0
Header set Pragma: no-cache
</Files>
Post Reply