diff --git a/router.php b/router.php index 1148bee..a02f839 100644 --- a/router.php +++ b/router.php @@ -53,15 +53,15 @@ function route($route, $path_to_include) $request_url_parts = explode('/', $request_url); array_shift($route_parts); array_shift($request_url_parts); - if ($route_parts[0] == '' && count($request_url_parts) == 0) { - // Callback function - if (is_callable($callback)) { - call_user_func_array($callback, []); - exit(); - } - include_once __DIR__ . "/$path_to_include"; - exit(); - } +if (count($route_parts) > 0 && $route_parts[0] == '' && count($request_url_parts) == 0) { + // Callback function + if (is_callable($callback)) { + call_user_func_array($callback, []); + exit(); + } + include_once __DIR__ . "/$path_to_include"; + exit(); +} if (count($route_parts) != count($request_url_parts)) { return; }