diff --git a/lib/endpoint.php b/lib/endpoint.php index ce0d177..f81419b 100644 --- a/lib/endpoint.php +++ b/lib/endpoint.php @@ -21,9 +21,16 @@ function getEndpoint($endpoint_name): string $endpoint_name = $routerRequest["page_name"]; } - $endpoint_file = $routerConfig["endpoint_dir"] . $routerRequest["subdomain"] . "/" . $endpoint_name . ".php"; + if($routerRequest["isToApex"]){ + $subdomain_part = ""; + } + else{ + $subdomain_part = $routerRequest["subdomain"] . "/"; + } - $endpoint_file_global = $routerConfig["endpoint_dir"] . "home/" . $endpoint_name . ".php"; + $endpoint_file = $routerConfig["endpoint_dir"] . $subdomain_part . $endpoint_name . ".php"; + + $endpoint_file_global = $routerConfig["endpoint_dir"] . "global/" . $endpoint_name . ".php"; if (file_exists($endpoint_file_global)){ $output = runEndpoint($endpoint_file_global); diff --git a/lib/router.php b/lib/router.php index 4223fcd..2ad4038 100644 --- a/lib/router.php +++ b/lib/router.php @@ -15,6 +15,7 @@ function initRouter(): bool $routerRequest["subdomain"] = $routerConfig["default_site"]; $routerRequest["domain"] = basename($routerRequest["requestAddress"][0]); $routerRequest["tld"] = basename($routerRequest["requestAddress"][1]); + $routerRequest["isToApex"] = true; } else {