» Design & Coding » How to stop someone hotlinking your images

Kevin MuldoonHow to stop someone hotlinking your images

Written by Kevin Muldoon from System0 on September 6, 2007

One week ago I wrote about how you can fight back against the scrapers, the content stealing scamming idiots who rip off posts from hard working bloggers. Since then, BloggingTips has unfortunately been scraped a few more times.

A blog about nothing, Elina from MyLlilAdventure and David from Pure Blogging were all kind enough to send me an email about two sites they found scraping me. Thanks guys, I really appreciate your support :)

The blogs which are scraping me are Blogging Orientated and Riza’s Site (dont worry, I’ve added the nofollow tag to these links!). Both sites are currently scraping every post which is published here. I have contacted Multiply about Riza’s site and I plan on faxing a letter to Google regarding Blogging Orienated. That site is using blogger so is covered by the Digital Millennium Copyright Act. It’s a bit of a pain that Google want you to fax a letter or send it by snail mail but at least they will do something about it.

htaccess code for preventing hotlinking

I had not got round to protecting my images from hotlinking sites until today but after seeing every one of my posts scraped by idiots I thought enough is enough, let’s have fun with these scumbags! There is only so much you can do when someone steals your content but stopping them hotlinking your images is something you do have control over.

I have used htaccess to protect hotlinking on several sites in the last few years however for those sites I stopped all sites from hotlinking. For Blogging Tips I only want to stop the domains I specifiy so I followed Surprise Highway’s excellent guide ‘How To Stop Hotlinking and Bandwidth Leeching‘ (I recommended this in my previous article too).

Here is the code I added to my htaccess file to stop them hotlinking images in the posts they are scraping.

RewriteEngine on

# Attempt to stop hot linking from these specific sites

RewriteCond %{HTTP_REFERER} ^(.+\.)?multiply.com/ [OR]
RewriteCond %{HTTP_REFERER} ^(.+\.)?blogspot.com/
RewriteCond %{REQUEST_URI} !/images/hotlinker.gif
RewriteRule .*\.(gif|jpg|png|avi)$ http://www.bloggingtips.com/images/hotlinker.gif

As you can see from the above code, I have blocked Blogger (Blogspot) and Multilply bloggers from hotlinking images here. I could have blocked all sites but for now I’m happy to just block the domains of scrapers I find. However, the above code didn’t work 100%, I checked BloggingTips on a newsreader and quickly noticed that the hotlinking image was being displayed there which is obviously not what I want.

I went back to Google and started searching for some htaccess tutorials. Thankfully I soon came across this article which said that you had to add the line below so that everyone else will still be able to link to the images.

RewriteCond %{HTTP_REFERER} !^$

The code I added to my htaccess file now looks like this :

RewriteEngine on

# Attempt to stop hot linking from these specific sites
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^(.+\.)?multiply.com/ [OR]
RewriteCond %{HTTP_REFERER} ^(.+\.)?blogspot.com/
RewriteCond %{REQUEST_URI} !/images/hotlinker.gif
RewriteRule .*\.(gif|jpg|png|avi)$ http://www.bloggingtips.com/images/hotlinker.gif

Now that we have got the correct code, we can now design an image which will be displayed in the scrapers blogs.

The image

The image I designed to show on the images in my posts was this :

Hotlinker image

Of course you could be more specific, you could write ‘This site is scraping content from my site’ or something like that. It’s really up to you.

Seeing it in action

Let’s see it in action!

* I’ve used my RSS post which I wrote 3 days ago and used the Blogging Orienated scraping site for this illustration.

Content Stealing blog before I edit my htaccess file
Before htaccess change

Content Stealing blog with my superhero hotlinking image displayed
My first hotlinking image

Increase the size of your hotlinking image

It’s worth noting that the image you specify to be displayed on sites which hotlink your image will be displayed in full ie. it doesn’t matter if your hotlinking image is 200 pixels in width or 300, the full image will be displayed. There is one limitation to this though.

Have a look at the screenprint below :

Increasing the size of your hotlinking image900 pixels in width and 460 pixels in height. It’s perhaps not too clear at first glance what has happened in the above screenprint but if you look closely you will see that the hotlinking image has been cut off. The reason for this is simple, the hotlinking image was too large for the content area.

Two things to note about this :

  • The image does not get cut off vertically ie. you could make your hotlinking image 3000 pixels in height if you wanted.
  • The hotlinking image did not expand to 900 pixels on this blog because the blog theme was coded correctly in CSS. Quite a lot of blog themes have problems with images which are too large therefore on another blog the image may have expanded to 900 pixels (ie. they would have expanded over the set content area)

If someone is stealing your content on a regular basis I suggest you get in the habit of placing images in your posts (smilies will do!). Then all you need to do is design a 5000 by 5000 pixel hotlinking image. See how long the scrapers will rip your site off if you do that!!!

Seriously, by making your hotlinking image large in height you are not only telling the scrapers website visitors that the content is stolen, you are also making it very difficult for anyone to read your article on their site.

Summary

Having your blog posts ripped off is frustrating, very frustrating. However, if you get in the habit of placing images in your posts and update your htaccess file to stop hotlinkers you will be able to annoy the scrapers and discourage them from stealing your content.

As I mentioned at the start of this post, stopping other people from hotlinking your images is something you do have control over so I encourage you all to bear this in mind if your content is being ripped off.

As always, if you have any questions regarding any of this, please let me know and I’ll do my best to help.

Good luck,
Kevin
:)

———————————————–

Articles referenced in this post :

Fighting back against the scrapers (My post about blog scraping last week)
Digital Millennium Copyright Act - Blogger - A google information page telling you how you can report scrapers who are using the Blogger platform.
How To Stop Hotlinking and Bandwidth Leeching - The first htaccess hotlinking tutorial I referenced.
Smarter Image Hotlinking Prevention - The second htaccess hotlinking tutorial I referenced which showed us how to limit our hotlinking image to the domains we want.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Bumpzee
  • E-mail this story to a friend!
  • Ma.gnolia
  • Print this article!
  • Reddit
  • StumbleUpon
  • Technorati
  • TwitThis
Written by Kevin Muldoon from System0 on September 6, 2007 | Filed Under Design & Coding

20 Responses so far | Have Your Say!

  1. A Blog about Nothing  |  September 7th, 2007 at 12:29 am #

    A Blog about Nothing - Gravatar

    Nice. That dog crap looks really… gross? And it links to auction ads. Are you trying to tell us something about them as well? :shock:

  2. RSS Newsniche  |  September 7th, 2007 at 12:45 am #

    RSS Newsniche - Gravatar

    I recently added a copyright notice to the end of each post in my RSS feed. I will be trying the image replacement technique soon.

  3. Wallace  |  September 7th, 2007 at 1:21 am #

    Wallace - Gravatar

    my site had been down several times,
    here is mine,
    it will block all other domains,

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC]
    RewriteRule \.(jpe?g|gif|bmp|png)$ nohotlink.jpg [L,NC]

  4. Laarni  |  September 7th, 2007 at 4:52 am #

    Laarni - Gravatar

    *PUKES* hehehe.

    Thanks for sharing. :)

  5. Kevin  |  September 7th, 2007 at 7:30 am #

    Kevin - Gravatar

    A Blog about Nothing - AuctionAds. It isn’t linked to auctionads, I wouldnt link to a site unless I was referencing it. Not sure how you think I did :)

  6. Kevin  |  September 7th, 2007 at 7:37 am #

    Kevin - Gravatar

    update - I removed the dogcrap hotlinking image I had used as an example - it was starting to make me feel sick!!!

    :)

  7. Kevin  |  September 7th, 2007 at 7:42 am #

    Kevin - Gravatar

    A Blog about Nothing - Just checked the site that is scraping BloggingTips, that site is adding auctionads links to all affiliate links. You must have got mixed up and thought I did that.

  8. A Blog about Nothing  |  September 7th, 2007 at 10:53 am #

    A Blog about Nothing - Gravatar

    Oh ok that makes more sense. I was wondering how you planned to sell someone on auction ads linked via a pile of dog crap. Lol

  9. Online Community Building  |  September 7th, 2007 at 12:39 pm #

    Online Community Building - Gravatar

    It never occurred to me to use this as a tactic against scrapers and splogs.

    What a great idea!

    - Martin Reed

  10. My Lil Venture  |  September 7th, 2007 at 9:04 pm #

    My Lil Venture - Gravatar

    Great tip Kevin. Hope it puts those idiots off from content stealing from your site :twisted:

  11. sikanrong  |  September 8th, 2007 at 4:29 pm #

    sikanrong - Gravatar

    I don’t know if it occurred to you, but if you serve up an image in place of the image you’re denying, they still get your bandwith. (Durrr… PWWWWND!)

  12. samulli  |  September 9th, 2007 at 9:08 am #

    samulli - Gravatar

    Thanks a lot for this article! I don’t even remember through which link I came here (I have about 15 different websites open at the moment), but I implemented this tactic right away in my own blog.
    Although I have to say, instead of blocking certain domains, I was rather more interested in protecting only certain of my folders against all external linking. I didn’t want to block all of my image folders, because I use some of my images on my own mySpace profile, for instance.
    Having no idea about this htaccess stuff I was afraid I might scramble my whole page or something, but luckily it worked fine on the first try. :wink:
    Thanks again for the idea!

    Sandra

  13. Kevin  |  September 9th, 2007 at 9:50 am #

    Kevin - Gravatar

    Wallace - Forgot to reply to your comment before, yeah that code will stop all domains. Thanks :)

    sikanrong - thats very true however this tactic is used to discourage people from stealing your imagea and your content. As you say, your bandwidth is still being used. However, you can make the hotlinking image very low on quality and filesize so that your bandwidth is reduced.

    samulli - Glad you got it working, It’s a very useful tactic in my opinion, particularly if people are stealing you content.

    If anyone is having problems with this please let me know :)

    Kevin

  14. Rose Sylvia  |  October 8th, 2007 at 9:22 pm #

    Rose Sylvia - Gravatar

    :?: What do think about stumblers using the StumbleUpon PhotoBlog It! tool to help their reviews of your blog stand out and send you more traffic? Hotlinking is an interesting paradox: while it does use bandwidth it also brings in traffic.

    I suspect that even additional bandwidth would cost less than advertising so it can be an economical way to grow blog readership and potentially blog income.

  15. aryadewangga  |  October 18th, 2007 at 4:40 pm #

    aryadewangga - Gravatar

    Dear: Mr Kevin and all blogging tips lovers.

    First at all I have to apologize for scrap and copy writing from blogging tips contents including images and videos. As for your information, I’m newbie/new blogger without knowing what I’ll do with blogging. Whatever I really love found blogging tips.com and give me inspiration how to start publishing on blog. But you know, English was not my first language ( My English is not so good), so at the time till know I just simply copy paste to my blog. One again I’m so sorry, really really sorry for my big mistake one.

    Sincerely yours,

    Aryadewangga

  16. Sparky  |  April 7th, 2008 at 6:32 pm #

    Sparky - Gravatar

    So has anyone figured out how to prevent people from hotlinking images on a Blogger/Blogspot blog?

    I am constantly posting blog items with images, only to find my blog item posted somewhere else, along with the images.

    I have not found any way to do this in Blogspot, unless I am missing something.

Trackbacks to 'How to stop someone hotlinking your images'

  1. Spotlight on Blogger Gems of the week (w/e 7 Sept 07)
  2. Weekly Links << Vandelay Website Design
  3. Your Stars Under A Project » Blog Archive » Articles today - ADP Shows American Workers How to Get More From Their Paycheck (Marketwire via Yahoo! Finance)
  4. Rivotril.

Leave Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>