---
author: marco
categories:
- Site Updates
date: "2005-11-24T18:14:07Z"
title: Hotlinks Off
---

I noticed that more and more of the requests to this site are for images that are embedded in somebody else’s pages. That’s quite a drag (as it has caused me almost to lose my other ISP for bandwidth violations until I turned it off).

What to do? Well, wonderful Google helped out.

People that link an image externally to save bandwidth are called <span style="font-style: italic;">bandwidth thieves</span> and their activity is called <span style="font-style: italic;">hotlinking</span>.

To turn their request off, you have to do a little work (nothing tragic). First, you have to turn on mod_rewrite…

  After you turned it on by making sure the LoadModule directive is turned on in the httpd.conf, you have to make sure that the Options directive includes FollowSymLinks.

Once that is done, add a .htaccess file to your image directory, and add the following lines into it:

<span style="font-family: courier new,courier,monospace;">RewriteEngine On</span>  
<span style="font-family: courier new,courier,monospace;">RewriteCond %{HTTP_REFERER} !^http://<span style="background-color: rgb(255, 102, 0);">diva\\.homelinux\\.org</span> \[NC\]</span>  
<span style="font-family: courier new,courier,monospace;">RewriteCond %{HTTP_REFERER} !^http://images\\.google\\.com \[NC\]</span>  
<span style="font-family: courier new,courier,monospace;">RewriteCond %{HTTP_REFERER} !^http://images\\.search\\.yahoo\\.com \[NC\]</span>  
<span style="font-family: courier new,courier,monospace;">RewriteCond %{HTTP_REFERER} !^$</span>  
<span style="font-family: courier new,courier,monospace;">RewriteRule \\.(jpe?g|gif|bmp|png)$ /images/hotlink.gif \[L\]</span>

(Of course, you’d use your own site instead of diva.homelinux.org…)

Restart your apache (if you had to change the settings in httpd.conf) and you are done. Don’t forget to put a readable image into /images/hotlink.gif!