From f19f59d53a4ee06c09d0e2e8b75dbe5336e81b46 Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Fri, 6 Sep 2024 12:53:25 -0700 Subject: [PATCH] fixed homepage --- src/Router.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; }