Archive

Posts Tagged ‘image hotlinking’

Protect your site from image hotlinking

February 25th, 2010

What is image hotlinking?

In layman terms I’d put it that an image that is stored on one server is linked and displayed on another website.

This affects the original image owner as loading of the image will take up the bandwidth, so if a very popular site or forum hotlinks to a site that has bandwidth quota, it might actually kill it. Literally.

Image hotlinking can be traced from the webservers log, or if the one who did it emailed the owner, just like what happened to LiewCF here.

I actually have noticed some image hotlinking and kept it in my mind to attend to it soon.

So when time came for me to perform some maintenance on this blog, I decided to address this issue.

Found two blogspot users:

1) http://gnagababu.blogspot.com/2009/12/vodafone-htc-tatto-launched.html

2) http://tech-flood.blogspot.com/2009/11/vodafone-htc-tatto-launched.html

I have replaced the images to show NO IMAGE HOTLINKING and my site’s url http://marvinlee.net

Do you notice that the two blogposts are actually the same? It’s obvious to me he is one lazy blogger who copied content and post them with duplicates.

Anyway, how do you resolve the problem of image hotlinking on your site?

I used the script below:

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]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} ^http://.*$
RewriteRule \.(jpe?g|gif|bmp|png)$ /media/nohotlinks.gif [L]

It’s modified from the original script over here:
http://docs.joomla.org/How_do_you_block_direct_hot_linking_to_image_files_using_.htaccess%3F

Some other references:

http://www.yourhtmlsource.com/sitemanagement/bandwidththeft.html

http://www.blogstorm.co.uk/htaccess-mod_rewrite-ultimate-guide/

Do you have any funny or annoying image hotlinking stories to share? 🙂

blogging, Cheatsheet, Internet, Open Source