Contact Lifestream



Hotlinking

I guess it would be a little late to write an article on hotlinking. LOL. But anyway, I was just looking at my stats for June and for some reason I took the time to browse the “Latest Visitors” section of cPanel’s stats and was stunned by the amount of people hotlinking to various images.

Yeah, I used to have htaccess protection but my script scribblings made the loading of images for subdomains fail and also I do some hotlinking myself from a few forums and sites (Last.fm for instance) back to this site and so I eventually just removed it. Well, as it turns out, I’m going to have to do something about it. Not that it’s doing much to my bandwidth at the moment, but things can change quickly in the wired world. And people need to learn not to hotlink, at least for their own sake, in terms of longevity and such. I mean, how fun is it really for these people to have images go dead all the time. It’s not just that hotlinking is rude, it is also very shortsighted.

Here are a few hotlinkers that I found among the recent 300 visits:

www.rosen-kreutz.net/public/balamb/forum/index.php?act=ST&f=4&t=4404
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=12980768
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=604333
www.apeldoorner.com/?p=fotos&aid=6531
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=15430737
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=2734508
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=1683606
oldforum.warriorsofdeath.net/viewtopic.php?t=6554
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=24416224
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=35907156
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=60916202
www.bannerlessbrotherhood.org/phpBB2/viewtopic.php?t=377
by117fd.bay117.hotmail.msn.com/cgi-bin/getmsg? . . . .
outtherabbithole.blogspot.com/
profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=36561894

Popular hotlinking targets include:
/gfx/clipart2/MemoirsOf_A_Geisha_poster.jpg
/gfx/clipart/buddyChrist.jpg

See a pattern here? I certainly do. I knew MySpace would get me one way or the other. Now, the question is if I can do some htaccess magic and send these people some hardcore porn instead. Or perhaps just disable hotlinking without so much commotion and japery. Or just ban MySpace. But how to avoid having to write exceptions for the sites that I want to be able to hotlink? It would be best to have an exception for a single /avatars/ folder or something.

For the definitive way to get around hotlinking I’d recommend the solution by A List Apart or Underscorebleach. It’s easy and can be implemented in several steps, from the simple htaccess blocking to the PHP augmented solution. As for allowing hotlinking to certain subfolders it is just a matter of giving these folders their own htaccess file containing simply RewriteEngine off. This solution combined with the suggestion from A List Apart should provide the ultimate coverage and without resorting to antics.

(UPDATE) Couldn’t get the php or shtml-based solutions to work. For some reason they only seemed to work if the receiving file resided within the same dir as the image in question. That would make for one file for every image dir (i.e. hundreds). I suspect that Apache for some reason isn’t sending the proper path info with REQUEST_FILENAME to output. So my $1 contains image.ext instead of path/to/image.ext and I found no way to salvage that or get around the problem. So I dropped it and used a static image instead for hotlinkers and nothing at all for those that link to images directly. Seems to work. Fingers crossed.


OpenDNS

Use OpenDNS

Worthy Causes