diff --git a/src/Router.php b/src/Router.php index e439b27..1dc2a0f 100644 --- a/src/Router.php +++ b/src/Router.php @@ -23,10 +23,18 @@ class Router { private function preparePath() { $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); + + //homepage + if ($path === '/') { + return $path; + } + + // remove empty directory path $path = rtrim($path, '/'); // remove trailing slash + //remove anything after and including ampersand $path = preg_replace('/&.+$/', '', $path); - + return $path; }