From b7997a95ba59c42d765ba6ad0aacaeea93725759 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 28 Jun 2011 13:11:41 -0700 Subject: [PATCH] Tweaked request URI determination. --- system/request.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/system/request.php b/system/request.php index e9b4d618..0252232d 100644 --- a/system/request.php +++ b/system/request.php @@ -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); @@ -62,10 +62,17 @@ public static function uri() $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