fixed homepage

This commit is contained in:
Nick Yeoman 2024-09-06 12:53:25 -07:00
parent 0c96ba6c90
commit f19f59d53a

View File

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