An end to those livejournal hotlinkers
Posted: Thu Apr 27, 2006 11:40 am
Once again, I spent the morning going through the stats of my sites and crying over the amount of bandwidth I lose to hotlinkers from myspace, livejournal, opendirviewer, and blogspot.
Renaming the images and then editing my blog entires to reflect the changes was an incredible pain in the butt. So, I did a google on it.
I added the following code into my .htaccess file
In a nutshell, the server now looks at the requesting URL and if it finds that the image was requsted by a page at any of the above domains, it replaces it with a very small gif file (about 7k).
Sure... I could have just told it to not serve up anything, but I'm trying to educate while wacking them with a stick.
Feel free to steal the above code and place it in your own .htaccess file (unless, of course, you have a site onj one of those domains and hotlink back to your own..... then it'll screw you over).
Oh.... you will have to have an replacement image in /images/ called no_hotlink.gif to make it work.
Oh... and here's the image I offer up in replacement to the one they hotlinked to.
Enjoy!
Renaming the images and then editing my blog entires to reflect the changes was an incredible pain in the butt. So, I did a google on it.
I added the following code into my .htaccess file
Code: Select all
# Begin hotlink image replacement
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?opendirviewer\.com/ [NC,OR]
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/no_hotlink.gif [L]
# End hotlink image replacement
Sure... I could have just told it to not serve up anything, but I'm trying to educate while wacking them with a stick.
Feel free to steal the above code and place it in your own .htaccess file (unless, of course, you have a site onj one of those domains and hotlink back to your own..... then it'll screw you over).
Oh.... you will have to have an replacement image in /images/ called no_hotlink.gif to make it work.
Oh... and here's the image I offer up in replacement to the one they hotlinked to.
Enjoy!