diff --git a/index.php b/index.php index 1019000..0b0d198 100644 --- a/index.php +++ b/index.php @@ -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";