Dorothea, over at Caveat Lector, is rewiring the connections between her old and new sites with Apache config-fu.
A few lines of config-fu saves hours of $SCRIPTING_LANGUAGE, and keeps your server-side architecture sane.
PHP’s $_SERVER hash, especially $_SERVER['REQUEST_URI'], is full of useful things for your script.
If you haven’t tried (please, in an access controled location) phpinfo (), do it.