Tag ‘images’ » Archiv


Comments Off

How to stop spam blogs from hotlinking your images with htaccess

December
21

It’s a pain in the arse when someone copies your content, especially when they hotlink your images so your bandwidth gets used instead of their own so here’s a neat way of adding to your .htaccess file so you prevent particular blog networks from displaying images from your hosting by hotlinking them.
Use this code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g|jpg|gif|bmp|png)$ http://www.commentluv.com/images/antihotlink.jpg [L]
</IfModule>

Just open up your .htaccess file (found in the root of your web space) and add the above lines. That should prevent blogs from myspace,blogspot and livejournal from hotlinking your images. You can add the url of a blog you know is hotlinking your images by following the format of the other RewriteCond statements.

Change the image url for the RewriteRule to one you have hosted somewhere (not on the same hosting because that will get redirected in a loop every time it is linked to).

It works pretty well, look at this screen shot of a self confessed content copier….
Content Thief owned

There a couple of my posts on that blog and they are littered with images telling the (probably non existent) readers to come and read the article here instead. Another reason to always have an image in my articles!

It’s a shame there isn’t a way to do that with content though! If you are having trouble with spam blogs scraping your content and images, you can read a fantastic article here on what to do when someone steals your content by Lorelle who has a treasure trove of WordPress and blogging information. Well worth a look!

Blog Tools, Code