From ffcaaac9d92541ffc632156942d1c26f44749755 Mon Sep 17 00:00:00 2001 From: Jefersson Nathan Date: Wed, 6 May 2015 10:42:36 -0300 Subject: [PATCH] Make possible to use PHPRouter on a subpath folder as `localhost/app/web` --- src/PHPRouter/Router.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PHPRouter/Router.php b/src/PHPRouter/Router.php index 8986e9b..9b6092c 100755 --- a/src/PHPRouter/Router.php +++ b/src/PHPRouter/Router.php @@ -101,6 +101,9 @@ class Router continue; } + $currentDir = dirname($_SERVER['SCRIPT_NAME']); + $requestUrl = trim(str_replace($currentDir, '', $requestUrl), '/'); + // check if request _url matches route regex. if not, return false. if (! preg_match("@^" . $this->basePath . $routes->getRegex() . "*$@i", $requestUrl, $matches)) { continue; -- 2.11.0