lucy24 - 4:25 pm on Jul 1, 2013 (gmt 0)
You can't "get rid of" something in an URL. You have to pick your preferred form and use it in the first place. If there's a request for the wrong form, redirect it. Then, when you get a request for "prettyfilename", rewrite to "uglyfilename.php?long-complicated-query".
The rewriting isn't done in php. (The redirect can be, though it usually isn't.) It has to happen in htaccess-- or, again, IIS equivalent-- before the request ever reaches your php file.
It is probably easier if you first explain in English, without code of any kind, what you want to do and what you want the human user to see.