'text/css', 'js' => 'application/javascript', 'svg' => 'image/svg+xml', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'ico' => 'image/x-icon', 'woff' => 'font/woff', 'woff2' => 'font/woff2', 'json' => 'application/json', ]; // Serve static files from public/ $filePath = $publicDir . $path; if (is_file($filePath)) { $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); if (isset($mimeTypes[$ext])) { header('Content-Type: ' . $mimeTypes[$ext]); } readfile($filePath); return true; } // Serve theme assets from the themes/ directory (e.g. /themes/default/js/theme.js) if (preg_match('#^/themes/([^/]+)/(.+)$#', $path, $m)) { $themeName = $m[1]; $themeRel = $m[2]; $themesDir = __DIR__ . '/../themes'; $themeFile = $themesDir . '/' . $themeName . '/' . $themeRel; $realThemes = realpath($themesDir); $realFile = realpath($themeFile); if ($realFile && $realThemes && strpos($realFile, $realThemes) === 0 && is_file($realFile)) { $ext = strtolower(pathinfo($realFile, PATHINFO_EXTENSION)); if (isset($mimeTypes[$ext])) { header('Content-Type: ' . $mimeTypes[$ext]); } readfile($realFile); return true; } http_response_code(404); return true; } // Admin routes: /admin/login → admin.php?route=login if (preg_match('#^/admin(?:/(.+))?$#', $path, $m)) { $_GET['route'] = $m[1] ?? 'dashboard'; require $publicDir . '/admin.php'; return true; } // Language-prefixed routes: /nl/page/path → index.php?lang=nl&page=page/path if (preg_match('#^/(nl|en)(?:/(.+))?$#', $path, $m)) { $_GET['lang'] = $m[1]; if (isset($m[2]) && $m[2] !== '') { $_GET['page'] = $m[2]; if ($_GET['page'] === 'guide') { $_GET['guide'] = '1'; } } require $publicDir . '/index.php'; return true; } // Root or unknown → index.php require $publicDir . '/index.php'; return true;