fix redir

This commit is contained in:
Bruno Rybársky 2024-01-11 09:47:52 +01:00
parent 1e2d754561
commit 1b8d19f6c7

@ -14,13 +14,17 @@ $dynamic_page_dir = "dynamic/";
$subdomain = basename(explode('.', $_SERVER['HTTP_HOST'])[0]);
$page_name = basename($_SERVER["QUERY_STRING"]);;
if(empty($page_name)){
$page_name = "index";
}
$srvname = $_SERVER["SERVER_NAME"];
$protocol = $_SERVER['PROTOCOL'] = isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) ? "https://" : "http://";
if (empty($page_name)){
header("Location: $protocol$srvname/$default_page");
return;
}
$dynamic_page_file = $page_dir . $subdomain . "/" . $page_name . ".php";
$page_file = $page_dir . $subdomain . "/" . $page_name . ".html";