Sex Sells: What to do about Image Leeching

Leeched Image vs Normal Image

Every now and then somebody builds a web site with the brilliant idea that they will uses images from other people's web sites as part of their content. They enjoy the benefits of the traffic (for example, advertising revenue), while the image owner ends up paying for the bandwidth. This is called image leeching.

What can you, as a web site owner, do about this?

If you're running a good web server, e.g. Apache, then you can block all requests to images from browsers which specify a referring site other than your own. In your .htaccess file, you can add a rewrite rule something like this:

  RewriteCond %{HTTP_REFERER} !^$                                  
  RewriteCond %{HTTP_REFERER} !^https?://*$ [NC]
  RewriteRule .*\.gif$        -                            [F]

This forces all requests for .gif files to fail ([F]) if the page in which the image is embedded (given to us as the Referer: (sic) in the HTTP request) is neither blank nor matches Refer to the Apache URL Rewriting Guide for more details.

But that's not much fun at all. Instead, why not enjoy yourself at the other web site's expense.

For example, at once time you could have clicked on an icon which included the word sex on a now defunct website called Strangely enough, that's not our normal icon. (As a software development company we don't actually have any XXX content so our normal icon is rather boring). But we looked at where you were coming from in our .htaccess file, and chose whether to give you the more interesting version:

  # Give visitors something more interesting
  # Note: due to a bug they often ask for //favicon.ico instead of /favicon.ico
  RewriteBase /
  RewriteCond %{HTTP_REFERER} iconsurf [NC]
  RewriteRule favicon\.ico$ sex_sells.ico [L]

Then, when you arrived, we would have re-directed you to this page:

 # Note the checks for the rewritten URI to prevent looping
 RewriteCond %{HTTP_REFERER} iconsurf [NC]
 RewriteCond %{REQUEST_URI} !^/sex_sells.ico$
 RewriteCond %{REQUEST_URI} !/misc/sex_sells
 RewriteRule !favicon\.ico$ [R,L]

Alternatively, you could have arrived at this page because a naïve search engine misclassified this page under the term sex image. Tempting as it is to redirect such traffic to a more alluring location, in this case we just make some small subtle changes to the text to reflect your likely interest.

With this combination of techniques, you can display what you like on the other site's page and, if they link to you, redirect any inbound traffic to the page of your choice.

Tools for Webmasters and Others

© Albion Research Ltd. 1993-2021
Need Better Web Hosting?

Can we suggest you look at some of the companies we've used?

Virtual private servers from only $5/month. Good for serious web apps. Can also be rented by the hour to test out your ideas.

Note: the above are affiliate links to companies we've used. Signing up using these links helps pay for the cost of this page.