Improved URI detection.
This commit is contained in:
parent
9b9a880326
commit
bd3b5f1800
|
|
@ -42,8 +42,6 @@ public static function uri()
|
||||||
{
|
{
|
||||||
throw new \Exception("Malformed request URI. Request terminated.");
|
throw new \Exception("Malformed request URI. Request terminated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = str_replace('/index.php', '', $uri);
|
|
||||||
}
|
}
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
// Neither PATH_INFO or REQUEST_URI are available.
|
// Neither PATH_INFO or REQUEST_URI are available.
|
||||||
|
|
@ -53,6 +51,21 @@ public static function uri()
|
||||||
throw new \Exception('Unable to determine the request URI.');
|
throw new \Exception('Unable to determine the request URI.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------
|
||||||
|
// Remove the application URL.
|
||||||
|
// -------------------------------------------------------
|
||||||
|
$base_url = parse_url(Config::get('application.url'), PHP_URL_PATH);
|
||||||
|
|
||||||
|
if (strpos($uri, $base_url) === 0)
|
||||||
|
{
|
||||||
|
$uri = (string) substr($uri, strlen($base_url));
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------
|
||||||
|
// Remove the application index.
|
||||||
|
// -------------------------------------------------------
|
||||||
|
$uri = str_replace('/index.php', '', $uri);
|
||||||
|
|
||||||
$uri = trim($uri, '/');
|
$uri = trim($uri, '/');
|
||||||
|
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue