I'm struggling with a mod_rewrite problem that involves .css files that are dynamically served by a "program" that reference images. I say "program" since the the tech stack is a bit obscure, but just insert your favorite technology there [perl | php | java].
The CSS file is referenced from the page using the following URL:
http://server/dir/subdir/file-program?site-id=1234&fname=stylesheet.css
The content of the CSS include image references like the following:
background-image:url('hello.png');
...
background-image:url('world.png');
The browser interprets these references as /dir/subdir/*.png.
What I want to do is rewrite all of those requests using the URL of the referrer so they end up looking like:
http://server/dir/subdir/file-program?site-id=1234&fname=hello.png
http://server/dir/subdir/file-program?site-id=1234&fname=world.png
Note that the site-id is variable, so I would really need to reference the referrer to pick up the whole query string. Sorry I left this out of the original post.
Put differently: Any image references that comes from ...file-program...*.css should be rewritten to use the URL (including query string) of that CSS, just substitute the image file name for the css file name.
Any help would be greatly appreciated.