<?php

$uri = rtrim(explode('?', $_SERVER['REQUEST_URI'])[0], '/');
if ($uri === '') {
    $uri = '/home'; // Don't call it "index" because nginx will catch it firstly
}
if (!str_contains($uri, '..') && file_exists($file = __DIR__ . $uri . '.php')) {
    include $file;
    exit(0);
}

echo $uri, PHP_EOL, '404 Not Found';
http_response_code(404);
