'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'webp' => 'image/webp', 'css' => 'text/css', 'js' => 'application/javascript', 'xml' => 'text/xml' ]; if (isset($mimes[$ext])) { header("Content-Type: " . $mimes[$ext]); } readfile($localFile); exit; } // 2. Sitemap if ($path === '/sitemap.xml') { include 'sitemap.php'; exit; } // 3. Search if (preg_match('#^/search/([^/]+)/?$#', $path, $matches)) { $_GET['q'] = $matches[1]; include 'index.php'; exit; } // 3b. Web Stories if (preg_match('#^/story/([^/]+)/?$#', $path, $matches)) { $_GET['story'] = $matches[1]; include 'index.php'; exit; } // 3c. Stories Sitemap if ($path === '/sitemap-stories.xml') { include 'sitemap-stories.php'; exit; } // 3d. Stories Index if (preg_match('#^/stories/?$#', $path)) { $_GET['stories'] = 1; include 'index.php'; exit; } if (preg_match('#^/stories/page/([0-9]+)/?$#', $path, $matches)) { $_GET['stories'] = 1; $_GET['page'] = $matches[1]; include 'index.php'; exit; } // 4. Comparison if (preg_match('#^/compare/([^/]+)/?$#', $path, $matches)) { $_GET['compare'] = $matches[1]; include 'index.php'; exit; } // 5. Top Lists if (preg_match('#^/top/([^/]+)/?$#', $path, $matches)) { $_GET['top'] = $matches[1]; include 'index.php'; exit; } // 6. Glossary if ($path === '/glossary' || $path === '/glossary/') { $_GET['glossary'] = 1; include 'index.php'; exit; } // 7. Detail Page: /brand/id/ if (preg_match('#^/([^/]+)/([^/]+)/?$#', $path, $matches)) { $_GET['cat'] = $matches[1]; $_GET['id'] = $matches[2]; include 'index.php'; exit; } // 8. Brand Page: /brand/ if (preg_match('#^/([^/]+)/?$#', $path, $matches) && !in_array($matches[1], ['index.php', 'sitemap.php', 'router.php'])) { $_GET['cat'] = $matches[1]; include 'index.php'; exit; } // Default to index.php include 'index.php';