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:



I have replaced the images to show NO IMAGE HOTLINKING and my site’s url

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:

Some other references:

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

blogging, Cheatsheet, Internet, Open Source