/var/www/html/index.php
echo $content;
} elseif (in_array('.well-known', explode('/', $url), true) !== false) {
header('Content-type: ' . util\File::get_mime_type($filename));
ob_start();
include $filename;
$content = ob_get_clean();
echo $content;
} else if(str_contains($url, "app-ads.txt")){
header("Content-type: text/plain");
ob_start();
include $filename;
$content = ob_get_clean();
echo $content;
} else {
$uri = explode('?', $_SERVER['REQUEST_URI'] ?? '')[0];
$fk_filename = __DIR__ . '/template/' . $_SERVER['HTTP_HOST'];
if (rtrim($filename, '/') == $fk_filename) {
$fk_filename .= '/index.php';
ob_start();
include_once $fk_filename;
$content = ob_get_clean();
echo $content;
exit();
}
// header("Content-type: ".mime_content_type($filename));
header('Location: /template/' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
// echo "found {$fk_filename} = {$filename}";
exit();
}
return true;
}
return false;
}
}
if (!function_exists('getScriptName')) {
function getScriptName()
{
$uri = explode('?', $_SERVER['REQUEST_URI'] ?? '')[0];
return (!empty($uri)) ? $uri : '/index.php';
}
/var/www/html/index.php
echo $content;
} elseif (in_array('.well-known', explode('/', $url), true) !== false) {
header('Content-type: ' . util\File::get_mime_type($filename));
ob_start();
include $filename;
$content = ob_get_clean();
echo $content;
} else if(str_contains($url, "app-ads.txt")){
header("Content-type: text/plain");
ob_start();
include $filename;
$content = ob_get_clean();
echo $content;
} else {
$uri = explode('?', $_SERVER['REQUEST_URI'] ?? '')[0];
$fk_filename = __DIR__ . '/template/' . $_SERVER['HTTP_HOST'];
if (rtrim($filename, '/') == $fk_filename) {
$fk_filename .= '/index.php';
ob_start();
include_once $fk_filename;
$content = ob_get_clean();
echo $content;
exit();
}
// header("Content-type: ".mime_content_type($filename));
header('Location: /template/' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
// echo "found {$fk_filename} = {$filename}";
exit();
}
return true;
}
return false;
}
}
if (!function_exists('getScriptName')) {
function getScriptName()
{
$uri = explode('?', $_SERVER['REQUEST_URI'] ?? '')[0];
return (!empty($uri)) ? $uri : '/index.php';
}
/var/www/html/index.php
include $filename;
exit();
}
$url = $_SERVER['HTTP_HOST'] . '/' . getScriptName();
if (LOCALHOST) {
$url = $allowed_hosts[0] . str_replace(BASE_DIR, '/', getScriptName());
}
//Check files in template directory for custom domains
$filename = __DIR__ . '/template/' . $url;
$found = false;
$filenames = [
$filename,
"{$filename}.php",
__DIR__ . '/template/' . $_SERVER['HTTP_HOST'] . '/' . CleanUrl::getPartAtIndex(0) . '.php'
];
foreach ($filenames as $filename) {
if (checkAndRenderFile($filename)) {
$found = true;
exit();
}
}
$filename = trim(getScriptName(), '/') . '.php';
if (file_exists($filename)) {
include $filename;
exit();
}
if (file_exists(CleanUrl::getPartAtIndex(0) . '.php')) {
$file = CleanUrl::getPartAtIndex(0);
$filename = __DIR__ . "/$file.php";
include $filename;
exit();
}
if (!$found) {
// header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
$default404File = __DIR__ . '/data/pages/404.php';
$domain404File = __DIR__ . '/template/' . $_SERVER['HTTP_HOST'] . '/404.php';