'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'webp' => 'image/webp', 'gif' => 'image/gif' ]; $mime = $mimes[$ext] ?? 'application/octet-stream'; header('Content-Type: ' . $mime); readfile($filePath); exit; } http_response_code(404); echo "File not found"; exit; } // Static Files $staticFile = __DIR__ . '/static' . $uri; if (file_exists($staticFile) && is_file($staticFile)) { $ext = strtolower(pathinfo($staticFile, PATHINFO_EXTENSION)); $mimes = [ 'css' => 'text/css; charset=utf-8', 'js' => 'application/javascript; charset=utf-8', 'json' => 'application/json; charset=utf-8', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'svg' => 'image/svg+xml', 'ico' => 'image/x-icon', 'woff' => 'font/woff', 'woff2'=> 'font/woff2', 'ttf' => 'font/ttf', 'html' => 'text/html; charset=utf-8' ]; $mime = $mimes[$ext] ?? 'text/plain; charset=utf-8'; header('Content-Type: ' . $mime); readfile($staticFile); exit; } // Default Single Page Application Entry header('Content-Type: text/html; charset=utf-8'); readfile(__DIR__ . '/static/index.html');