Hotlinking – what is it and how to stop it

For the past few days i’ve been going on about hotlinking as a means to slash JPEGr‘s monstrous diet of over 20 gigs of bandwidth a day.

JPEGr’s June bandwidth on Lunarpages was 600+ gigs. That was over 10 days :mrgreen: An average of 60 gigs a day. To put that in some sort of perspective, this site – smemon.com uses about 0.02gigs per day (20mb’s). So i can probably just about forgive Lunarpages for becoming a little worried 😛

So what was the cause of this massive data transfer? Well, there are several reasons but the short answer is Hotlinking. Wikipedia explain better than i do. Basically hotlinking involves using other peoples bandwidth for displaying pictures, rather than using your own bandwidth.

So with JPEGr and any image host you have hundreds/thousands of people uploading files to our server, then linking to them. Linking to them is ok, but displaying them is in effect, stealing bandwidth. Now you might argue the whole point of an image hosting site is to host imagess and that’s precisiely why i was so reluctant ever enable hotlink protection on JPEGr.

But as you can see, bandwidth is verging on a ridiculous size considering JPEGr only has about 400 members and gets between 100-300 unique hits/day. So currently you can’t display images like this;

jpegr1.JPG

It’s a change i didn’t want to have to make as i believe image hosting sites should allow hotlinking. But i can’t afford a dedicated server, and running JPEGr at a loss really isn’t something i’d fancy 🙄

So hotlinking has caused this problem and in short – enabling hotlink protection will save me or the next owner hundreds of €€€.. Like i’ve said in my last post, i’ll be keeping a close eye on JPEGr for the next week or so and i’ll see how the stats are. If traffic remains stable or increases and bandwidth consumption is low i could well put selling it on hold until the next PR update. JPEGr is a PR4, predicted PR5.

But if people don’t like the new hotlink policy and traffic deminishes, it will most likely be sold. With BeerChief on the way and my bank balance rapidly falling, i could soon have no choice but to sell it anyway 😛

If you want to enable hotlink protection (and for blogs or standard sites i think you should), you can do so by editing the .htaccess file in your root.

Add in the following code;

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com.*$ [NC]
RewriteRule .*.(gif|jpg|jpeg|bmp)$ http://www.yourdomain.com/stophotlinking.html [R,NC]

It could save you some hassle in the future 😉

Leave a Reply