CartMetrix - Do you know yours?

« Logging and Monitoring Apache | Home | When Not To Blog »

8/4/2005

Stop Bandwidth Thieves

Hotlinking can be a major pain on highly loaded servers. Hotlinking is where another site links directly to your images/movies/downloads on their site effectively making you pay (in bandwidth and server usage) for people to view your content on their site.

One client, I saw a 40G pipe that always became saturated in the middle of the day drop to below ~32G at peak after hotlink protection was enabled.

To stop hotlinking add a .htaccess file in your root directory with something like the following:

RewriteEngine On
# replace domain.com with your domain name
# also allows for http://domain.com and http://www.domain.com
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain\.com/ [NC]

# skips if http_referer is not passed by client
RewriteCond %{HTTP_REFERER} !^$

# send a nasty image instead (make it a small one)
RewriteRule \.(jpe?g|gif|png)$ /images/goaway.jpg [L]

# or save bandwidth all together by just sending an error back
#RewriteRule \.(jpe?g|gif|png)$ - [F]

Popularity: 13%

Trackback:

Related Posts

2 Responses to “Stop Bandwidth Thieves”

  1. damonparker.org » Logging and Monitoring Apache said:

    […] An introduction to Service Data Objects for PHP | Home | Stop Bandwidth Thieves 8/4/2005 Logging and Monitoring Apache […]

  2. damonparker.org - Stop Bandwidth Theives - Lighttpd Style said:

    […] Previous hotlinking post provided a solution for Apache servers only. Here is one for Lighttpd. […]

Post your opinion

Verification Image

Please type the letters you see in the picture.

Subscribe without commenting


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2009 damonparker.org. all rights reserved.

Close
E-mail It