forked from Adleraci/adlerka.top
test
This commit is contained in:
parent
6c1f4b6a9d
commit
77ec0423fb
@ -28,15 +28,27 @@ function initRouter(){
|
||||
|
||||
$routerRequest["page_name"] = basename($_SERVER["QUERY_STRING"]);
|
||||
|
||||
if (empty($routerRequest["page_name"])){
|
||||
if (empty($routerRequest["subdomain"])) {
|
||||
// Subdomain is missing
|
||||
$needsRedirect = true;
|
||||
} elseif (empty($routerRequest["page_name"])) {
|
||||
// Page name is empty
|
||||
$needsRedirect = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($needsRedirect) {
|
||||
$redirectAddress = implode('.', $routerRequest["requestAddress"]);
|
||||
if (empty($routerRequest["page_name"])) {
|
||||
// Redirect without page name
|
||||
header("Location: " . $routerRequest["protocol"] . $redirectAddress . "/");
|
||||
} else {
|
||||
// Redirect with default page name
|
||||
header("Location: " . $routerRequest["protocol"] . $redirectAddress . "/" . $routerConfig["default_page"]);
|
||||
}
|
||||
exit; // Ensure that the script stops execution after the redirect header
|
||||
}
|
||||
|
||||
return !$needsRedirect;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user