Site icon Mostly Harmless

Internet! You kids get off the lawn!

I have a few blog entries about Gundam episodes and Gunpla and I often put up graphics either of the model I’m assembling or image from the anime I am watching.

This is the Internet and I don’t mind people copying the images onto their website. I mean, why would I? Some of the images aren’t mine, like the Ubuntu logo. if I get an e-mail from Sunrise about a Gundam 00 image, I’d be shocked and flattered.

But I do not like hotlinking and had been blacklisting new URLs on a regular basis. Hotlinking is when some individual on the Internet decides he likes something on my website, so he loads it directly from my server onto his page.

Myspace users do that a lot.

So rather than continue looking at my logs and zapping offenders one at a time, I finally put in the following into my .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://blog.dembowski.net/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dembowski.net/ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*.google..*/ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*.yahoo..*/ [NC]
RewriteCond %{HTTP_REFERER} !^http://.*.msn..*/ [NC]
RewriteRule .*.(gif|jpg|jpeg|png)$ - [F,NC]

This lets search engines that I like get copies of the images (I run a web server on the Internet, I want people to find me). The second line lets the web server load images if there is no referer.

If you try to load an images onto your website from my web server, and you are not on the approved list, then the image will not load. I thought about putting in a “Don’t hotlink you loser” image but why bother? I just want hotlink to my website to stop.

Exit mobile version