$uriPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $path = trim($uriPath, '/'); if ($path !== '' && $path !== 'index.php') { if (strpos($path, '.') === false) { $protectedPrefixes = [ 'file', 'dist', 'vendor', 'uploads', 'siplah', '_profiler', '_wdt' ]; $protected = false; foreach ($protectedPrefixes as $prefix) { if (strpos($path, $prefix) === 0) { $protected = true; break; } } if (!$protected && preg_match('/^[a-zA-Z0-9\/\-_]+$/', $path)) { $slug = str_replace('/', '-', $path); $pageDir = __DIR__ . '/assets/pages/'; $file = $pageDir . $slug . '.php'; if (is_file($file)) { header('Content-Type: text/html; charset=utf-8'); include $file; exit; } } } }