Papermashup

Subscribe


Tweets


"RT @bethgordon: .@Tesco Please rethink archaic 'Approved by Mums'. Pretty sure it's not just mothers who make childcare decisions. https://…"

@ashleyford 3 days ago

"Is there ever a time that @DFS doesn't have a sale on?"

@ashleyford 6 days ago

Designer and web developer, Co-founder and Technical Director at Harkable.com. Previously I worked at Spotify, MySpace and InMobi. Contact me - ashley[at]papermashup.com

Plagiarism and how to stop image hotlinking with .htaccess

AshleyAshley

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.

Designer and web developer, Co-founder and Technical Director at Harkable.com. Previously I worked at Spotify, MySpace and InMobi. Contact me - ashley[at]papermashup.com

Comments 15
  • Mia
    Posted on

    Mia Mia

    Reply Author

    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 ! 😀 * 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 😀
    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.


  • Tony
    Posted on

    Tony Tony

    Reply Author

    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!


    • Ashley
      Posted on

      Ashley Ashley

      Reply Author

      @Tony, yeah i was only alerted about it when I got a pingback from his site. Glad you found it back here though! :)


  • Jay
    Posted on

    Jay Jay

    Reply Author

    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
      Posted on

      Ashley Ashley

      Reply Author

      @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! :)


  • Yossi
    Posted on

    Yossi Yossi

    Reply Author

    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
      Posted on

      Ashley Ashley

      Reply Author

      @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.


  • billy
    Posted on

    billy billy

    Reply Author

    tried your code
    but keyboard arrow key not working


    • Ashley
      Posted on

      Ashley Ashley

      Reply Author

      @billy this code won’t affect the use of your keyboard.


  • Jared
    Posted on

    Jared Jared

    Reply Author

    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


  • Dainis Graveris
    Posted on

    Dainis Graveris Dainis Graveris

    Reply Author

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


    • Ashley
      Posted on

      Ashley Ashley

      Reply Author

      @Dainis no problem, i didn’t want to see someone else get ripped off like i did.


  • Visualsuspect
    Posted on

    Visualsuspect Visualsuspect

    Reply Author

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


    • Ashley
      Posted on

      Ashley Ashley

      Reply Author

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