A while back, I discovered that someone was embedding one of my photos in their own web site. It showed up in my referer logs pretty frequently. I contacted the owner and asked him to stop. I never heard back.

So I decided to have a little fun with him.

If you're easily offended, stop reading right here. I don't want to read your complaints if you think I've done something crude. Go elsewhere and take your judgments with you. Thanks.

Anyhoo, the image he used was this one. It's the house I owned in Ohio before I moved to California and decided to pay twice as much for a crappy apartment. He linked to it from this page. So I decided to use mod_rewrite to serve a different image to his visitors and only his visitors.

(You may see the wrong image on his site if your browser decides to cache it. Just force a reload (shift-reload on most browsers) if you do.)

How'd I do it?

Easy.

Added this to the right VirtualHost block of Apache's httpd.conf file:

RewriteCond %{HTTP_REFERER} ^http://members.asianavenue.com/I_am_that_guy/$
RewriteRule ^/pics/house/DCP00047-320.jpg$ /images/babyshit.jpg [P]

Tested it, and restarted.

Magic.

Go forth and spread the mod_rewrite love.

And don't use my images without asking. It's just rude.

Posted by jzawodn at June 30, 2003 02:18 PM

Reader Comments
# tfr said:

Yeah, mod_rewrite is a Darn Cool Thing. I've used it in most of my projects for the last 3 years (including my homepage) to redirect all the nice (and search-engine-friendly) URLs to a single PHP script, that then does all the magick.

on June 30, 2003 02:40 PM
# François said:

No matter what, the original image that is supposed to appear on *your* site is the same as on his, this cute baby ;-). I tried it on three different browsers.

Anyway, examples of the wonders of mod_rewrite are always welcome, especially when they are illustrated :-)

on June 30, 2003 02:50 PM
# Justin Blanton said:

BWAHAHAHA. Excellent.

on June 30, 2003 03:24 PM
# jim winstead said:

i wonder what image you'll have to come up with in order to deal with the inevitable use of the baby picture by another site.

on June 30, 2003 03:26 PM
# Jason said:

I LOVE IT! Stealing images just really sucks. Most of the work I do involves photographers and they really hate to have their images stolen...so we use mod_rewrite quite a bit...maybe we should do something like this instead!

Excellent!

on June 30, 2003 03:42 PM
# chip said:

Heh heh ... I had a similar experience.

on June 30, 2003 04:05 PM
# Chris said:

Too funny!
Reminds me of one of the overclocking sites I frequent. They found out some other site was stealing their images, and copying their hardware reviews.

The whole forum contributed images of readers flipping the bird, then implimented the mod_rewrite stuff. The stealing site had nothing but images of people flipping the middle finger.

Way too funny.

on June 30, 2003 04:36 PM
# anders said:

i generally use the goatse.cx picture for exactly this purpose.

on June 30, 2003 04:51 PM
# Tim A said:

Great use of mod_rewrite - nothing more!!!

on June 30, 2003 05:27 PM
# George Schlossnagle said:

That's funny. I used to work for the company that manages those sites. I forwarded the link there for a good laugh.

on June 30, 2003 05:29 PM
# wdr1 said:

Genius.

on June 30, 2003 09:29 PM
# Steve Friedl said:

i-am-that-moron.com

on June 30, 2003 10:39 PM
# Darren said:

I had this problem too.
I eventually decided to just block access and I use Apache's SetEnvIf directive to check the referrer.

It won't happen again as I protect all my images using this technique now.

on July 1, 2003 03:59 AM
# brandt said:

a triumph Z. indicative of some of your best work.

on July 1, 2003 06:23 AM
# Hemo said:

Sad.. but you might have to fight off the Internet Nazi's now for posting child porn ...

oth.. use mod_rewrite to give them a nice photo of some fermented roadkill..

on July 1, 2003 07:49 AM
# Jeremy Zawodny said:

Porn?

Are you kidding?

on July 1, 2003 07:52 AM
# Gerald said:

Check the IP of this dubious entry with http://www.geobytes.com/IpLocator.htm and tell us whether the distance to Beverly Hills, CA is significant ;-)

on July 1, 2003 08:07 AM
# netron said:

i too feel a bit uncomfortable with the usage of that baby picture - it's not the kiddie-porn aspect. its the fact that the kid didnt, and cant, give consent to having an embarrassing photo spread far and wide across the internet.
the kid IS a human being. you should respect that.

much better with some roadkill picture , as suggested above.

sorry jeremy, but i just feel its plain wrong to post that baby photo - and in bad taste.

cool mod rewrite tip though... i can see the funny side of it.

on July 1, 2003 01:26 PM
# Jeremy Zawodny said:

What part of this:

If you're easily offended, stop reading right here. I don't want to read your complaints if you think I've done something crude. Go elsewhere and take your judgments with you. Thanks.

Was unclear?

on July 1, 2003 02:12 PM
# netron said:

you'll understand Jeremy when you have a kid yourself. My perspectives on this sort of thing certainly changed when i had my first kid a year ago. Yours probably will too , in time.

Good blog otherwise, but i still think that was in bad taste. Not your best moment (your best was the "PageRank is Dead" moment - loved that one!)

What the hell -it's your blog...!

on July 1, 2003 02:44 PM
# David said:

I think it was a great selection of a photograph for this situation. I am curious, however, in what context your house picture was used?

on July 1, 2003 04:43 PM
# Steve Friedl said:

> you'll understand Jeremy when you have a kid yourself.

(rolling eyes)

You'll understand when you have a sense of humor yourself

on July 1, 2003 05:08 PM
# Sergio González said:

Yes... poor kid. He will be traumatized for the rest of his life. He will be know like the kid who made chocolate pupu.

And is your fault Jeremy!

(End of sarcasm)

C'mon netron!!!. Admit it... it was a good one!

on July 1, 2003 08:02 PM
# david said:

I can see what newton is saying. And no I don't have kids. It's funny thing to do. And easily offended is one thing, but this is a grey area of when you should have rights to distribute things. I guess since the parents probably took the photo they are legal guardians of the child, and therefore it can be distributed however they want it. If that kid is grown up now and doesn't care that that photo is distributed around the net, then that's cool too. However there is a point with the protecting rights of children.

I don't think the mod_rewrite thing was ever meant to get into a big argument about stuff like that anyway. It's a good trick to know and use :)

on July 1, 2003 11:19 PM
# Doug said:

You people must be mental. You are actually arguing that this baby's rights have been violated? No one even knows who this kid is. It is "Generic Baby who's parents took a picture of it crapping because they are freaking weird" in the minds of every person who sees it. There is no violation of rights here. What right would they be violating? The right to privacy? ITS A FREAKING BABY!

on July 2, 2003 06:59 AM
# Matthias said:

If I had such a picture of one of my childs, I would provide it for that reason!! :)

"Unfortunately" the guy realized it!

[quote]
"Tuesday July 1st, 2003: [...] Sorry Jeremy...looks like you got me back g-o-o-d. [...]"
[/quote]

:( ;)

on July 3, 2003 10:20 AM
# netron said:

>You'll understand when you have a sense of >humor yourself

its staggering how there is such a lack of human empathy in the world. "humor" at the expense of others misfortune isn't "humor". It's just plain wrong - especially when it's a child. Its just wrong wrong wrong. Pity some other people viewing this board seem to have a total lack of morality or sense of empathy towards other human beings on this planet.
But , it IS jeremy's blog - so i'd better get off my soapbox, shut the hell up, and respect Jeremy's freedom of speech. i do so under protest, but i do respect, highly, his right to speak freely. I just want to make that point - i'm not a Christian funde Nazi - i'm an atheist libertarian.

on July 3, 2003 03:42 PM
# Howard Hansen said:

As a father of two, I can guarantee you that all of you -- every mother's son or daughter -- generated effluvia like that and much, much worse. It's amazing the messes that newly-minted moms and dads handle. If this photo is the worst embarassment this young lady suffers, she can count herself lucky! And just to be sure, put a dollar in her therapy fund.

on July 11, 2003 12:40 PM
# cjaugey said:

I have used mod rewrite to have nice search engine friendly links on some webpages I made, but I have never thought of this idea with the stolen pictures. VERY cool... I'll try this sometime! CJ

on November 1, 2003 02:27 PM
# djsmummy said:

U r sad and sick for putting a image like that on the web for all to see. I dont care if you dont want to read my complaint...at least everyone else will. You should feel lucky that you are so far away from me (i'm from england) as i could quite happily come and knock your head off!!

on January 8, 2005 04:39 AM
# John said:

Mod-rewrite is one of the coolest features I've seen in a while, use it all the time to make more SEO friendly sites.
A really nifty script I got at scriptdownloads.com basically automatically creates the code needed for modrewrite ;)

on January 31, 2005 02:47 PM
# Artur Armman said:

Jeremy's fun with mod_rewrite helped me with two things. 1) Realise that mod_rewrite is fun and 2) create doriat mod_rewrite board. That would be good to create a collection of personal stories about mod_rewrite as well :) At any rate mod_rewrite is cool and more i get into it more fun i have with it. Thanks for sharing this story Jeremy and thank you being somewhat my inspiration :)

on April 12, 2005 09:06 PM
# h0b0s said:

Do you think you a hacker?? :)))))))
The problem is that he just linked your image and not copied to his server! :)))

I recently found your page searching internet for more mod_rewrite information...


Idi nahui, daun, bliat'!

on June 25, 2005 08:50 AM
# >Nuts< said:

Pretty cool o:)

Anyway I would also advise everyone to watermark all your valuable pix because the thieves can copy them to their own site as well...

on August 15, 2005 01:54 PM
# mark said:

Ha! Similar thing happened to me recently: http://blog.underafter.com/2005/12/05/busted/

I just swapped out the image, nothing too fancy. But I like your solution. Nice work!

on January 6, 2006 09:39 AM
# Amer Neely said:

Found this site while on a hunt for 'mod_rewrite' stuff. I love your use of it - I will be adopting it for my use. Thanks for the tip.

on November 4, 2006 10:44 AM
# mod rewrite said:
on May 4, 2007 09:29 AM
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.