Weblog entry #14 for lee

Rewriting per referer in Apache
Posted by lee on Wed 8 Mar 2006 at 16:01
Tags:

When people check the web stats reports and see that half their bandwidth is going towards serving images embedded into the pages of a certain "community website" popular with the 16-29 demographic, their usual request is to block images that don't come via a specific referer.

But, if you're after a little fun, you can rewrite the images based on referer if you have apache's mod_rewrite available.

Given the age of the users of the site in question, it's probably unwise to redirect to anything too graphic or controversial, but I like the idea of New Kids on the Block spontaneously appearing on some emo kid's profile... Heheh, pure evil.

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://profile.site.example.com/.*$ [NC]
RewriteRule ^/img/indieband\.jpg$ http://images.example.org/nkotb.jpg [R]

 

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search