June 30, 2003

Fun with mod_rewrite

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?


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.


Go forth and spread the mod_rewrite love.

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

Posted by jzawodn at 02:18 PM

It pays to be an eBay exec

From TheStreet.com:

With the full approval of its board, eBay is issuing ever-increasing amounts of stock options, transferring an unusually large portion of the company's market value to corporate insiders. And many of these insiders have wasted little time in cashing in, selling hundreds of millions of dollars worth of stock, even as other investors, especially mutual funds, have bought up the shares.

And it seems that even the peons might benefit:

Despite these concerns, eBay shareholders last week overwhelmingly approved a proposal that would increase the number of shares available under its latest stock plan by more than 50%. The proposal would allow the company to give away an estimated $1 billion worth of options, about $250,000 per employee, this year alone. This year's handout is more than four times eBay's net income last year.

Nice. A little more of the mini-bubble, perhaps?

Posted by jzawodn at 12:03 PM

Google API Offline Aagain, MT pissed

This sucks.

MovableType is great, but...

Every time that api.google.com times out (like now), MT decides that it can't build pages anymore. Therefore, I cannot post.

500 Can't connect to api.google.com:80 (connect: timeout) at /home/jzawodn/public_html/mt/lib/MT/Template/Context.pm line 1749

I know that's because I use the Google API search results in my pages, but shouldn't it just timeout and gracefully continue as if the call returned no results?

Yeah, I thought so. The only options offered are "Close" and "Go Back." Given that this stuff is all loosely coupled, it really ought to be designed to deal with failure--not just give up.

Has anyone patched MT to work around this problem? I'm sure this problem isn't specific to me.

This will get posted eventually, I hope.

Update: Yup, had to post this a day later.

Posted by jzawodn at 10:28 AM