I guess that you have static html pages?
I hope your server has been updated since 1997, but you should probably check that. The easiest (and most efficient) way to handle that is probably SSI (Server Side Includes).
How you enable SSI to parse your pages before sending the output to the client depends on the version of apache you are running.
The SSI could look like this:
<!--#if expr="$REQUEST_URI = /bluewidgets/" -->
<img src="/blue.gif" />
<!--#elif expr="$REQUEST_URI = /redwidgets/" -->
<img src="/red.gif" />
Look at the Apache Website for how to enable and test it: For Apache2 [httpd.apache.org] or Apache 1.3 [httpd.apache.org]. But if you're still on Apache 1.3, you really should be thinking about moving.