The problem here is that the GET part causes the regex match to fail, so any single level request fails to be rewritten. ("/foo?stuff" or "/bar/?stuff"). I keep trying different regex patterns, but none fix it.

Then with the rest, the get request is recognized, but the last part of the normal url gets ignored. So, "/foo/bar/abc?test=true" results in "router.php?foo&bar&test=true"

I figure most of this is just a matter of fixing errors with my regex, but any help would be greatly appreciated.

This should turn something like "/foo/bar?test=true" to "router.php?path=foo/bar&test=true. My regex tests show that the expression is correct and matches what I want it to, but for some reason it's not working once it's applied to the server rules.

"/foo/bar" and "/foo/bar?" correctly rewrite, but as soon as I add anything past the question mark the rewrite fails and I just get a 404 error for "/foo/bar" was not found. Anyone have any idea why this is happening, or some sort of debugging tool that could help me figure out why it's not matching correctly?