Hold on... I just realised that the script I gave you wouldn't work. It uses the $_GET array, but really you want to be able to rewrite any URL (not just the one the page was called by). How about this...
function rewrite($url)
$ParsedURL = parse_url($url);
$Parts = parse_str($ParsedURL["query"]);
{
foreach($Parts as $key=>$value)
{
$rewrite.= '/' . $key . '/' . $value;
}
echo $rewrite;
}
...this script parses the URL (ie. seperates it into host, path, query, etc). Then it takes query (the bit after the ?) and splits it into key-value pairs, using parse_str().
And yes, you should be able to call:
rewrite("page/?id=435");
...but remember the quotation marks!