Blocking Bandwidth Leeches
Version: 16.3
Revision: 42 Build 68
Blocking Bandwidth Leeches
Introduction: this script was made for users who would like to block others from stealing your images and used them on forums, blog and search engines.
You can also use this source to kill those linkers from stealing your own bandwidth!
1.] Download Notepad++ from this website and install it…
———————
http://filehippo.com/download_notepad/
2.] Copy this source code and save your file as…
File type: .htaccess
Notes: save this file as: “All types”.
Example…
——————–
RewriteCond %{HTTP_REFERER} ^http://(www\.)?mysite\.com [NC]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?google\.com [NC]
Tips: you can cancel out the dashes and use this style instead…
———————————–
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]
———————————–
Single website linking – blocked
—Copy Source Code—
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]
—End Source Code—
If you want to block multiple websites, you can use this source code which is provided below.
Notes: the last line on “RewriteCond %{HTTP_REFERER}”, it must have an [NC] codes or it will not work!
Multiple website linking – blocked
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpe [L]
—End Source Code—
Notes: you can also add different extension to enhance your file protection.
To do this just take a look and compare this code below from the above…
—Copy Source Code—
RewriteRule .*\.( jpeg|jpg|gif|png|mp3|zip|rar)$ - [F]
—End Source Code—
Copyright 2001-2008 Lair360
Blocking all hotlinker!
If you want to block hotlinking completely, so that no one can hotlink your files, you can use this source instead of the above.
Advice: replace some of my trusted website with your own website. After that, just upload the file to your ftp server.
Warning: if you’re going to redirect someone to a different image, that image must not be on your FTP server or you will create an infinite loop!
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(.*\.)?lair360.srhost.info [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.*\.)?lair360.wordpress.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.*\.)?stonerocket.net [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]
—End Source Code—
This source is a little lighter and less aggressive. It’s also easy to maintain…
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?lair360.srhost.info/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?lair360.srhost.info/blog/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ - [F]
—End Source Code—
This is the final source to allow only trusted website to hotlink your images.
You must also allow your website on the first line to allow your webpage to upload this images…
—Copy Source Code—
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?lair360.srhost.info [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?lai360.srhost.info/blog/ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?stonerocket.net [NC]
RewriteRule \.(jpg|jpeg|png|gif|zip)$ - [NC,F,L]
—End Source Code—
Notes: you can also change one of the “RewriteRule” to forbid users from stealing your images and bandwidth.
—Copy Source Code—
RewriteRule \.(jpeg|jpg|gif|png|mp3|zip|rar)$ /images/nohotlink.jpe [L] RewriteRule \.(jpeg|jpg|gif|png|mp3|zip|rar)$ - [F]
—End Source Code—
Copyright 2001-2008 Lair360
To block Search engines, you can use this instead…
Notes: it will not block all of the search engines. This example will only block yahoo, google and askjeeves.
—Copy Source Code—
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?google.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?yahoo.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?askjeeves.com [NC]
RewriteRule \.(jpg|jpeg|png|gif|zip)$ - [NC,F,L]
—End Source Code—
Copyright 2001-2008 Lair360
This is another alternative, you can also use this source code…if you desire…
Allowing multiple sites and block all other sites.
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?you\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?ok1\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?ok2\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$ - [F]
—End Source Code—
Allowing one site and block all other sites.
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?you\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$ - [F]
—End Source Code—
Here is the bonus and it also works!
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?lair360.srhost.info [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?lair360.wordpress.com [NC]
RewriteCond %{HTTP_REFERER} !^http://(.*\.)?stonerocket.net [NC]
RewriteRule .*\.(jpg|jpeg|png|gif|zip|rar)$ - [F]
—End Source Code—
As I’ve said this before, you can use this code below instead of using the [F] command.
—Copy Source Code—
RewriteRule .*\.(jpeg|jpg|gif|png|mp3|zip|rar)$ /images/nohotlink.jpe [L] RewriteRule .*\.(jpeg|jpg|gif|png|mp3|zip|rar)$ - [F]
—End Source Code—
Copyright 2001-2008 Lair360
This source code will only block some outside url and not all of them…
Nevertheless, this source is only use for advance users!
—Copy Source Code—
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain1.com(/)?.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain2.com(/)?.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain3.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|png)$ - [F]
—End Source Code—
Copyright 2001-2008 Lair360
This is also an alternative with an option to allow “Symlink”.
But, if you want to use this option, you’ll need to remove one of the special character from the second line.
—Copy Source Code—
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain1.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourotherdomain2.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourotherdomain3.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|jpg|png|js|css)$ - [F]
—End Source Code—
Enjoy your experiment and have fun blocking these bandwidth idiots!
Copyrighted By Lair360


