diff --git a/src/Pecee/SimpleRouter/RouterBase.php b/src/Pecee/SimpleRouter/RouterBase.php index 5fdd7aa..5439178 100644 --- a/src/Pecee/SimpleRouter/RouterBase.php +++ b/src/Pecee/SimpleRouter/RouterBase.php @@ -86,7 +86,7 @@ class RouterBase { $this->currentRoute = $route; - if($route instanceof RouterGroup && is_callable($route->getCallback())) { + if($route instanceof RouterGroup && $route->matchRoute($this->request) && is_callable($route->getCallback())) { $group = $route; $route->renderRoute($this->request); $mergedSettings = array_merge($route->getMergeableSettings(), $settings); @@ -126,12 +126,6 @@ class RouterBase { $route = $this->controllerUrlMap[$i]; - if($route->getGroup() !== null) { - if($route->getGroup()->matchDomain($this->request) === false) { - continue; - } - } - $routeMatch = $route->matchRoute($this->request); if($routeMatch) { diff --git a/src/Pecee/SimpleRouter/RouterGroup.php b/src/Pecee/SimpleRouter/RouterGroup.php index a44c91f..739bf81 100644 --- a/src/Pecee/SimpleRouter/RouterGroup.php +++ b/src/Pecee/SimpleRouter/RouterGroup.php @@ -66,7 +66,12 @@ class RouterGroup extends RouterEntry { } public function matchRoute(Request $request) { - return null; + // Skip if prefix doesn't match + if($this->getPrefix() !== null && stripos($request->getUri(), $this->getPrefix()) === false) { + return false; + } + + return $this->matchDomain($request); } public function setExceptionHandler($class) {