HOTlink

<1 min read

[@776]
HOTlink

Some teen on myspace.com decided to hotlink a picture from my blog. Apparently she's extremely popular, because I started to noticed a serious increase in my bandwidth usage.

I don't really give a hoot about hotlinking, except when I see my bandwidth jump by 3 folds. Here's what I added to my Apache configuration to block the worst offenders:

<Directory "/path/to/images/blog">

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://([^/]+)myspace\.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+)bobpitch\.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+)shopping-news\.com/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+)forumfree\.net/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+)mongsr\.us/.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+)allcumfacials\.com/.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|png|bmp|mov|mpg|avi)$ - [NC,F]
</Directory>

I don't really want to block everyone, as it would cause problems with web-based aggregators, like bloglines, etc.

Since there are no reasons to hotlink images from my scrapbook, I also added rules to prevent it altogether:

<Directory "/path/to/scrapbook">

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://([^/]+)thauvin\.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule .*\.(gif|jpg|jpeg|png|bmp|mov|mpg|avi)$ - [NC,F]
</Directory>

I still let Google, Yahoo and people using Google's cache through.