public function getRequestURI()
{
// WARNING. This function URI excludes query string
if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
// IIS
$request_uri = $_SERVER['HTTP_X_REWRITE_URL'];
} elseif (isset($_SERVER['REQUEST_URI'])) {
// Apache
$request_uri = $_SERVER['REQUEST_URI'];
} elseif (isset($_SERVER['ORIG_PATH_INFO'])) {
// IIS 5.0, PHP as CGI
$request_uri = $_SERVER['ORIG_PATH_INFO'];
// This one comes without QUERRY string
} else {
throw new BaseException('Unable to determine RequestURI. This shouldn\'t be called at all in CLI');
}
$request_uri = explode('?', $request_uri, 2);
return $request_uri[0];
}