servePhpFile($sitePath, '/portfolio.php'); } // /portfolio/{slug} → portfolio-page.php?slug={slug} if (preg_match('#^portfolio/([a-z0-9-]+)$#', $path, $m)) { $_GET['slug'] = $m[1]; return $this->servePhpFile($sitePath, '/portfolio-page.php'); } return parent::frontControllerPath($sitePath, $siteName, $uri); } private function servePhpFile(string $sitePath, string $file): string { $_SERVER['SCRIPT_FILENAME'] = $sitePath . $file; $_SERVER['SCRIPT_NAME'] = $file; $_SERVER['DOCUMENT_ROOT'] = $sitePath; return $sitePath . $file; } }