Tweaked request URI determination.

This commit is contained in:
Taylor Otwell 2011-06-28 13:11:41 -07:00
parent 1aa86d0798
commit b7997a95ba
1 changed files with 10 additions and 3 deletions

View File

@ -53,7 +53,7 @@ public static function uri()
} }
// ------------------------------------------------------- // -------------------------------------------------------
// Remove the application URL. // Remove the application URL and any extra slashes.
// ------------------------------------------------------- // -------------------------------------------------------
$base_url = parse_url(Config::get('application.url'), PHP_URL_PATH); $base_url = parse_url(Config::get('application.url'), PHP_URL_PATH);
@ -62,10 +62,17 @@ public static function uri()
$uri = (string) substr($uri, strlen($base_url)); $uri = (string) substr($uri, strlen($base_url));
} }
$uri = trim($uri, '/');
// ------------------------------------------------------- // -------------------------------------------------------
// Remove the application index and any extra slashes. // Remove the application index.
// ------------------------------------------------------- // -------------------------------------------------------
$uri = trim(str_replace('/index.php', '', $uri), '/'); $index = Config::get('application.index');
if (strpos($uri, $index) === 0)
{
$uri = (string) substr($uri, strlen($index));
}
// ------------------------------------------------------- // -------------------------------------------------------
// If the requests is to the root of the application, we // If the requests is to the root of the application, we