Stop Stealing My Bandwidth!

5 min read

Deviation Actions

Echilon's avatar
By Echilon
0 Favourites
0 Comments
1K Views
I checked my server logs last night, just to see if there was anything interesting. I use two different domains, one for my blog and one for images I use on forums and the like, so the logs for mi6.nu, my images domain are like a breadcrumb trail of my last month's browsing. I was pretty surprised to see a few URLs I'd never heard of as the referrers. A finnish site about Lordi was one and MySpace.com was the other. I hate MySpace, and there's no way I'd have wasted my bandwidth hosting pictures for it. The images being linked was Contemplating Existence, a wallpaper I made last year. Some Idiot was using the image as his background. It's great that he liked my wallpaper but firstly it's my property, he can't use it without my permission, and secondly, it's over 200KB, and was loaded 350 times in December. That's 65MB of bandwidth I've paid for!



I decided to teach the leech a lesson using .htaccess, which lets you serve up a different image for specified referrers. Inspired by a recent blog post I'd read, I thought the Goatse pic would be a good choice. For anyone that doesn't know, Goatse was a site available at the turn of the millenium which scarred millions of impressionable AOL kiddies. Now whenever someone from an external site tries to use one of those images, they'll get a nice surprise. Let that be a lesson to anyone else who's thinking of leeching my bandwidth! The MySpace guy's changed his background, but the site about Lordi's still using that dodgy background.


For anyone that's interested, this is the .htaccess file for Apache. The second and fourth lines tell apache to apply the rule for any host other than leghumped.com, the third and fifth lines tell it to serve up the no-hotlinking image instead of the requested URL.

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^leghumped.com/(.*)$ [NC]
    RewriteRule ^images/lordi.png$ images/nolink.png
    RewriteCond %{HTTP_REFERER} !^leghumped.com/(.*)$ [NC]
    RewriteRule ^images/tesla.jpg$ images/nolink.png


For anyone that's interested, this is the .htaccess file for Apache. The second and fourth lines tell apache to apply the rule for any host other than leghumped.com, the third and fifth lines tell it to serve up the no-hotlinking image instead of the requested URL.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^leghumped.com/(.*)$ [NC]
RewriteRule ^images/lordi\.png$ images/nolink.png
RewriteCond %{HTTP_REFERER} !^leghumped.com/(.*)$ [NC]
RewriteRule ^images/tesla\.jpg$ images/nolink.png
Published:
© 2007 - 2021 Echilon
Comments0
Join the community to add your comment. Already a deviant? Log In