// you’re reading...

Blog

Blog: Stop Stolen Content with Apache Mod_Rewrite!

I was checking my wordpress admin panel, and noticed a new incoming link today. Oh cool, I thought. Someone nice has linked to me. I opened up the link to check it out and there was my article on how to set up a cisco router as a webserver. The whole thing. Images. Dynamips/Dynagen .net files. Everything! Everything copied word for word with someone else claiming they had written it down the bottom! And he/she had the gall to hotlink to my images! Grrrrr

I guess once your blog becomes popular enough that people start stealing your content, its kind of a milestone, but it kind of pissed me off. I read Lorelle’s fantastic post on what to do when someone steals your content, and shot of a few email’s which were ignored. I had to do something to protect my content. Hotlinking like this is just plain rude!

I fired up notepad and with a bit of research on apache’s mod_rewrite I have implemented this:

.htaccess:


RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://ardenpackeer.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.ardenpackeer.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !^http://www.feedburner.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://feeds.feedburner.com/ardenpackeer.*$ [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png|txt|net)$ /nolink.jpg [NC,L]

I copied this .htaccess file to my uploads directory under wordpress. Now when someone hotlinks they get something like this:

Stolen Article:

Stolen Article

The Rewrite Condition is basically saying if a link is not from ardenpackeer.com, google, feedburner, then redirect all images to http://ardenpackeer.com/nolink.jpg. Its probably not perfect, but it did the job!

I could of been evil and did something like:

RewriteRule .*\.(jpe?g|gif|bmp|png|txt|net)$ http://goatse.cz/ [NC,R]

Using the [NC,R] you can redirect them to whatever site (or picture) you want >-).

I’m going to have to put a watermark image on my pictures now! I hope this helps someone else who is facing a similar problem.

Discussion

2 comments for “Blog: Stop Stolen Content with Apache Mod_Rewrite!”

  1. “I could of been evil and did something like:


    RewriteRule .*\.(jpe?g|gif|bmp|png|txt|net)$ http ://goatse.cz/ [NC,R]

    Using the [NC,R] you can redirect them to whatever site (or picture) you want >-).”

    LOL!!!

    I will definitely not be hotlinking to any of your images! :-)

    Posted by cciepursuit | March 4, 2008, 3:47 am
  2. Heheh. I saw soooo tempted….

    Posted by Arden Packeer | March 8, 2008, 5:27 pm

Post a comment


Twitter Feed...

Follow me...

View Arden Packeer's profile on LinkedIn Arden Packeer ClaimID Add to Technorati Favorites TwitterCounter for @ardenpackeer