An end to those livejournal hotlinkers

A place for anything and everything.
Post Reply
User avatar
bio
Resident Junky
Posts: 6644
Joined: Tue Dec 31, 2002 12:24 pm
Location: Spokane, WA
Has thanked: 26 times
Been thanked: 43 times
Contact:

An end to those livejournal hotlinkers

Post by bio » 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

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
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!
"That's What"
- She
User avatar
jc
chipotle quetzalcoatl
Posts: 720
Joined: Thu Jan 09, 2003 1:23 pm

Post by jc » Thu Apr 27, 2006 6:00 pm

You are my god.
User avatar
bio
Resident Junky
Posts: 6644
Joined: Tue Dec 31, 2002 12:24 pm
Location: Spokane, WA
Has thanked: 26 times
Been thanked: 43 times
Contact:

Post by bio » Fri Apr 28, 2006 9:09 am

j00 want for I to edit your .htaccess file?
"That's What"
- She
User avatar
jc
chipotle quetzalcoatl
Posts: 720
Joined: Thu Jan 09, 2003 1:23 pm

Post by jc » Fri Apr 28, 2006 9:10 am

Yes please.
User avatar
bio
Resident Junky
Posts: 6644
Joined: Tue Dec 31, 2002 12:24 pm
Location: Spokane, WA
Has thanked: 26 times
Been thanked: 43 times
Contact:

Post by bio » Fri Apr 28, 2006 10:04 am

done
"That's What"
- She
User avatar
jc
chipotle quetzalcoatl
Posts: 720
Joined: Thu Jan 09, 2003 1:23 pm

Post by jc » Fri Apr 28, 2006 11:45 am

Thank you. Not that I really think many people were hotlinking my crap...
User avatar
bio
Resident Junky
Posts: 6644
Joined: Tue Dec 31, 2002 12:24 pm
Location: Spokane, WA
Has thanked: 26 times
Been thanked: 43 times
Contact:

Post by bio » Fri Apr 28, 2006 12:18 pm

It looks like you have a file being linked to from groovygamers.com.

I checked your logs :D
"That's What"
- She
User avatar
jc
chipotle quetzalcoatl
Posts: 720
Joined: Thu Jan 09, 2003 1:23 pm

Post by jc » Fri Apr 28, 2006 8:12 pm

Yep, that's me.

I'm a DnD dork remember. Groovygamers.com is a forum for dorks like me.
Post Reply