Blocking Bandwidth Leeches ~ V2.1

lair360

New Member
Messages
200
Reaction score
0
Points
0
Version: 18.1
Revision: 42 Build 154

Introduction: This source was made for user to block bandwidth theif.

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”

Warning: you must clear your system cache to see the changes…

Details: add some of your offending website, blogs or search engines…ect.

Example…
——————–
Code:
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…
———————————–
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]
———————————–

Single website linking - blocked
—Copy Source Code—
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—
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—
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—
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—
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—
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—

End of Part One...
 

lair360

New Member
Messages
200
Reaction score
0
Points
0
Start of Part Two...

Notes: you can also change one of the “RewriteRule” to forbid users from stealing your images and bandwidth.

—Copy Source Code—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule \.(jpeg|jpg|gif|png|mp3|zip|rar)$ /images/nohotlink.jpe [L][/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule \.(jpeg|jpg|gif|png|mp3|zip|rar)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—

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—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteEngine on[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?google.com [NC,OR][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?yahoo.com [NC,OR][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?askjeeves.com [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule \.(jpg|jpeg|png|gif|zip)$ - [NC,F,L][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—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—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteEngine On[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.+\.)?you\.com/ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.+\.)?ok1\.com/ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.+\.)?ok2\.com/ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^$[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—

Allowing one site and block all other sites.
—Copy Source Code—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteEngine On[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.+\.)?you\.com/ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^$[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule .*\.(jpg|jpeg|gif|bmp|png|swf)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—

Here is the bonus and it also works!
—Copy Source Code—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteEngine On[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^$[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.*\.)?lair360.srhost.info [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.*\.)?lair360.wordpress.com [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(.*\.)?stonerocket.net [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule .*\.(jpg|jpeg|png|gif|zip|rar)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—

As I’ve said this before, you can use this code below instead of using the [F] command.

—Copy Source Code—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule .*\.(jpeg|jpg|gif|png|mp3|zip|rar)$ /images/nohotlink.jpe [L][/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule .*\.(jpeg|jpg|gif|png|mp3|zip|rar)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—

This source code will only block some outside url and not all of them. But, this source is only use for advance users!

—Copy Source Code—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteEngine On[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain1.com(/)?.*$ [NC,OR][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain2.com(/)?.*$ [NC,OR][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} ^http://([a-z0-9]+\.)?domain3.com(/)?.*$ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule .*\.(gif|jpg|png)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—

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—
Code:
 [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteEngine on[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]# Options +FollowSymlinks[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^$[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain1.com/.*$ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourotherdomain2.com/.*$ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourotherdomain3.com/.*$ [NC][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]RewriteRule \.(gif|jpg|jpeg|jpg|png|js|css)$ - [F][/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
—End Source Code—
Copyrighted by Lair360
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
nice tut, this'll help those who want more control than what cpanel offers

i've never heard of using a jpg image with the extension of jpe, but google says its valid
 
Last edited:

lair360

New Member
Messages
200
Reaction score
0
Points
0
nice tut, this'll help those who want more control than what cpanel offers

i've never heard of using a jpg image with the extension of jpe, but google says its valid

Thank you very much for your complement!
Well...I make articles to assist other users. I also put a lot of efforts into these articles, so that users could choose, read and enjoy the qualities of my work...
 

808solutions

New Member
Messages
7
Reaction score
0
Points
0
wow thank you for the code, its to bad alot of people dont take the time to set up htaccess, leaving sites vulnarable to attack, dos, or like you said file leeching :|
 
Top