If I understand you correctly, you have variables that you want to strip out of the URL, not variables that are appended to the URL....if this is the case, you can use $SCRIPT_FILENAME to get the absolute pathname of the currently executing script. From that point, you can strip out the info that you need in a multitude of ways.
Hope this helps
Good luck!
Darren