« Monastery for Geeks | Main | Visual News Slide Shows »

Stop, Thief!

One of the costs in hosting a website is bandwidth – the amount of data downloaded from your web site. While browsing thru the access_log file, which lists what files are being downloaded, I noticed a number of entries from some of the social web sites. Entries that were just pointing to an image, not a web page. What to do? Point them to something else.

If you have the ability to create a .htaccess file on your web server, just add these lines:

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9\-]+\.)?myspace\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://([a-z0-9\-]+\.)?xanga\.com [NC]
RewriteRule \.(gif|jpe?g|png)$ /images/monkey.gif [NC,L]

Now all image requests from myspace look like this:

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)