forked from Adleraci/adlerka.top
		
	test
This commit is contained in:
		@@ -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"]);
 | 
			
		||||
        header("Location: " . $routerRequest["protocol"] . $redirectAddress . "/" . $routerConfig["default_page"]);
 | 
			
		||||
        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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user