Files
xamxam/app/router.php
Pontoporeia de2e7a61ee feat: single entry point routing — convert to front controller pattern
- Create app/public/index.php as front controller (bootstrap + Dispatcher)
- Rewrite app/router.php for PHP dev server → all non-asset requests to index.php
- Update Dispatcher to render full page layouts (head+header+view+footer)
- Move public view templates into templates/public/ (home, search, tfe, about, repertoire)
- Delete dead direct-access public/*.php files (apropos, search, tfe, licence, repertoire)
- Add clean URL routes to Dispatcher (/search, /tfe, /repertoire, /apropos, /licence, /media)
- Remove .php extensions from all internal links (header, views, templates, URLs)
- Update OG tags in controllers to use clean URLs
- Update nginx posterg.conf → front-controller try_files pattern, block direct .php access
- Update header.php and search-bar.php form actions to clean URLs
- Switch AboutController nav key from 'nav' to 'currentNav' for consistency
2026-04-20 12:42:15 +02:00

21 lines
688 B
PHP

<?php
/**
* Router script for PHP built-in development server (php -S).
*
* All non-asset requests go through the front controller (public/index.php).
* Static files (CSS, JS, images, fonts) are served directly.
*/
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
// Static assets: let the dev server handle them directly
$ext = pathinfo($uri, PATHINFO_EXTENSION);
if (in_array($ext, ['css', 'js', 'png', 'jpg', 'jpeg', 'gif', 'ico', 'svg', 'woff', 'woff2', 'ttf', 'eot', 'map'], true)) {
return false; // serve directly
}
// Send everything else through the front controller
$_SERVER['SCRIPT_NAME'] = '/index.php';
require __DIR__ . '/public/index.php';
return true;