more ads

Kamat's Potpourri


Subscribe to Site Feed
RSS Feed for AnthoBLOGy

Kamat's PotpourriNew Contents
About the Kamats
History of India
Women of India
Faces of India
Indian Mythologies
geographica indicaArts of India
Indian Music
Indian Culture
Indian Paintings
Dig Deep Browse by Tags
Site Map
Historical Timeline
Master Index
Research House of Pictures
Stamps of India
Picture Archive
Natives of India
Temples of India
Kamat Network
Blog Portal


Vikas Kamat
 Vikas Kamat is a programmer- entrepreneur living in Birmingham AL. This blog is a complex mix of Indian culture, life in southern USA, computer sciences, and sports. Opinions are his own.
 About - Bio - Contact

Friend Me on Facebook


Best of AnthoBLOGy

Unripe Revolution
Rooster's Dharma
Don't Know Jack
No Love for Condi
Blogger's Block
Father of  the Bride
TinTin's Diary - I
TinTin's Diary II
Hate Bollywood
Child Labor
M.F.Husain Guilty
Marathi & Konkani
Artist's Daughter
India's First IT Guru


Computing, Libraries, Tennis, India & other interests of Vikas Kamat


Previnting Bandwidth Durable Link to this BLOG
Preventing Bandwidth Stealing on Apache Servers

The other day I wrote about how some people are not only stealing our pictures, but also our server bandwidth. Today I will tell you of a solution I have implemented on Many people write scripts (in languages such as Perl, PHP or ASP) to prevent unauthorized linking to websites. However, is not a dynamic website, but a statically rendered website designed for high-performance, so I did not have that luxury (see Amateur Webmaster: Static Rendering of Websites). However, Apache server has a very powerful feature called Rewrite Rules by which the server behavior can be changed dynamically with the help of rules. The end result is same as that implemented by scripts performing the same functions, but with this approach I did not have to change any of our content production or publication system. Without further ado, I present the solution:

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^*$ [NC] RewriteCond %{HTTP_REFERER} !^*$ [NC] RewriteCond %{HTTP_REFERER} !^*$ [NC] RewriteCond %{HTTP_REFERER} !^*$ [NC] RewriteCond %{HTTP_REFERER} !^*$ [NC] RewriteCond %{HTTP_REFERER} !^*$ [NC]

RewriteRule .*\.(gif|GIF|jpg|JPG)$ [R]


In line 1, tell the server to alter (or rewrite) its rule for serving. In lines 2 through 8 I define all the authorized server linking. This is necessary because people might be entering the website via different naming conventions (upper case, lower case, IP, with and without the www sub-domain). In line 9, I redirect the unauthorized request to a Copyright Violation Notice.

Just put the above rules in your WebServer configuration file, and you are done. I couldn't believe how simple it was. Do not try to do a similar thing with Microsoft Internet Information Server (IIS), because you simply can't -- a solution with IIS requires that your website is dynamically served.

The Amateur Webmaster: Tips for amateur (and professional) webmasters.

(Comments Disabled for Now. Sorry!)First Written: Saturday, November 17, 2001
Last Modified: 11/16/2001

Browse More Entries


About Me:


Powered  NOT by Blogger or MovabaleType or WordPress, but by SimplyBlog, a software I wrote to create blogs.
See details of implementation or download SimplyBlog.



Dictionary Look up

Kamat PICTURESearch

Kamat Glossary Search

Kamat BLOGSearch

Amazon Search

Yahoo Mail Secure Site - Requires Login
GMail Secure Site - Requires Login
Hotmail Secure Site - Requires Login
BBC News
Yahoo! News
Kamat News
Indian Blogs
Blog Network
My Mailing List
Friends of Kamat
USTA TennisLink
What's New
What's Old
Adhika Prasangi
Frequent Visits
Lyons Computers
Dave Winer
Birmingham Local


This is how I surf the web. Turns out creating your own start page beats all portals, back-flipping, personalized corporate pages, and book-marking tools.
Kamat's Potpourri Vikas KamatBlog

© 1996-2014 Kamat's Potpourri. All rights reserved. Do not reproduce without prior permission. Standard disclaimers apply

Merchandise and Link Suggestions

    Top of Page