Use your left/right keys to browse tutorials
Plagiarism and how to stop image hotlinking with .htaccess

Plagiarism and how to stop image hotlinking with .htaccess

1 Star2 Stars3 Stars4 Stars5 Stars
Posted on August 9, 2009

My last blog post was on how to make an autosuggest tool with jQuery, no sooner had i pressed the publish button did i find my complete blog post on guidesigner.net I had spent time and effort writing that tutorial for the people who read my blog and for the love of the internet, there’s certainly no financial gain in blogging for me, I have a few Google ads but i do it purely because i’m passionate about the internet. to find the exact post on guidesigner.net made me livid! not only had the owner (I’m not afraid to name and shame!) Shehzad Mehmood (or on twitter @shahzadvu) completely copy my post word for word but he also hotlinked my download and demo images straight from my server so i was paying for the bandwidth! I would have been more sympathetic if the site had provided a link to my site along with an explanation of how the guy found my post, but nothing. It was clear to see that all this guy does is scour the internet for blog posts to copy to his site to then make money out of through well placed and sometimes intrusive advertising.

guidesigner-hotlink

Rant over, i’ll tell you what i did.

Firstly i modified my .htaccess file with the help of David Airey and his great post on image hotlinking and the solution.

Add this to your .htaccess file and you should be in business :)

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?papermashup\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !msn\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png|jpg)$ images/hotlink.jpe [L]

the code above uses the mod_rewrite module built into PHP to filter out the domain name referrer so anyone who links to an image on your domain will see (in the code aboves case) hotlink.jpe. the reason we use jpe is because jpeg and jpg are filtered out. This code however still allows Google, Microsoft, MSN, and Yahoo search engines index your site images.

The result:

Its entirely up to you but i stuck with David Aireys approach and saw it as free advertising from the people who steal content, this is the result on guidesigner.com after i implemented the changes.

hotlink

Hope this helps other frustrated bloggers that have their content completely ripped from their site.


Recent shares

More tutorials from Papermashup
Comments
15 discussions around Plagiarism and how to stop image hotlinking with .htaccess
  1. Mia says:

    WOW, that is beyond shameless and downright pathetic ! The same incident has occurred with a friend Web designer of mine – someone just lifted her entire design ( she’s on the Blogger platform – so, images are very easy to grab from one’s page source ) ; her content of course was not copied ( as the site which is using her design simply advertises fashion items ) , however : this is beyond deplorable ! It’s like visiting someone’s house and stealing the silverware !
    This is a great approach towards content theft , however – I stumbled upon a few WP Plugins the other night and there is a plugin which literally makes your content Invisible when someone attempts to copy it ! No matter how many times they attempt to do it – it renders it invisible every time ! I love that ! :D * I would pay money just to see the look on the faces of the content perps who attempt something like that though – it would be worth it I believe :D
    P.S: for anyone who wants to download the above mentioned plugin [ " Houdini " ] they can do so HERE.
    PPS: There should be a Wall of Shame for content thief’s , so that every designer & developer out there knows of their existence !

    Thank you for this great script & tut Ashley :)

    M.

  2. Tony says:

    Doh! I remember now – I actually got that script from there first!! It was only when I found the issue, and wanted to report, but couldn’t for the life of me recall where I got it, i found the Papermashup reference in a file.

    Thieving sod!

  3. Jay says:

    Nice! I was writing a watermark script for all uploaded images to do the same thing, then someone pointed me your tutorial, I am going to leverage your script with my script, double protection :)

    Thanks!

    • Ashley says:

      @Jay thanks for dropping by, glad you found it useful! let us know how you get on with your watermark. I’d be interested to know! :)

  4. Yossi says:

    There are a few problems with HTTP_REFERER.

    Some firewalls don’t pass the information correctly, and it can be user-defined.
    So, in any point, if used for system verification it can be altered.

    I thought of using HTTP_REFERER for AJAX confirmation.
    If it’s from my website, allow AJAX request. Otherwise, send it to the real address without the AJAX.
    Since it can be easily altered, I decided to setup a local session for each user when he first enters my website. When the session is over – the AJAX is over..

    • Ashley says:

      @Yossi, Completely agree with that. The use of the HTTP_REFERER in this case is purely a preventative measure against image hotlinking, and as you pointed out this can certainly be manipulated.

  5. billy says:

    tried your code
    but keyboard arrow key not working

  6. Jared says:

    Good one, Ashley,

    It looks like your friend over at GUIDesigner.net has removed the hotlinked images but your post is still copied in its entirety. Pathetic.

    ~Jared

  7. oh, good one – I will definitely implement it too! thanks! :)

  8. Haha nice one!
    It’s a shame someone copies an entire post without pointing out the real author.

    • Ashley says:

      @Visualsuspect sure is, I couldn’t believe there was no link back! but i feel better after my ‘free hotlink advertising’ ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

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



Looking for a registry cleaner to speed up your PC and show a full diagnostics?

Never miss an update from Papermashup

Get notified about the latest tutorials and downloads.

Subscribe by Email

Get alerts directly into your inbox after each post and stay updated.
Subscribe
OR

Subscribe by RSS

Add our RSS to your feedreader to get regular updates from us.
Subscribe

Get in contact

Please use the form below to get in touch.

About Me

I'm Ashley Ford, Co-founder and Technical Director at Harkable.com London, UK. Previously I worked at InMobi, Spotify and MySpace. My interests include photography and making short videos I'm also an avid F1 fan. I'm always working on side projects. Here are a few: Easy Poll, We Deliver.



What do you specialise in?

I spend a lot of time coding in PHP and MySQL, as well as front end XHTML and CSS. I also specialise in javascript and the jQuery framework as well as being an avid designer. You can find me on dribbble

Interested in advertising?

If you'd like to advertise on Papermashup.com you can find details here Or use the contact link below for further advertising opportunities.

How do I contact you

You can contact me here. and I'm available for consultation, freelance, programming book reviews.

Get on the mailing list

Join over 3000 people who have subscribed to the Papermashup inbox message, and be the first to find out about tutorial, competitions and giveaways.