From 11d0aa2c7a5a5b33eb84595acbc0e636966f5f63 Mon Sep 17 00:00:00 2001 From: SteamPixel Date: Mon, 16 May 2016 17:41:04 +0100 Subject: [PATCH] Corrected root page bug --- Route.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Route.php b/Route.php index 584697e..4d6b49f 100644 --- a/Route.php +++ b/Route.php @@ -41,7 +41,12 @@ class Route{ if(Config::get('basepath')){ - $route['expression'] = '('.Config::get('basepath').')/'.$route['expression']; + //Add / if its not empty + if($route['expression']!=''){ + $route['expression'] = '/'.$route['expression']; + } + + $route['expression'] = '('.Config::get('basepath').')'.$route['expression']; } @@ -51,11 +56,11 @@ class Route{ //Add 'find string end' automatically $route['expression'] = $route['expression'].'$'; + //echo $route['expression'].'
'; + //check match if(preg_match('#'.$route['expression'].'#',self::$path,$matches)){ - - //echo $expression; - + array_shift($matches);//Always remove first element. This contains the whole string if(Config::get('basepath')){