38471-vm/page_bootstrap.php
2026-05-03 06:58:37 +00:00

23 lines
695 B
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/page_routes.php';
if (!defined('APP_PAGE')) {
http_response_code(500);
exit('Route bootstrap is missing APP_PAGE.');
}
if (PHP_SAPI !== 'cli' && strtoupper((string)($_SERVER['REQUEST_METHOD'] ?? 'GET')) === 'GET' && !page_request_is_ajax() && isset($_GET['page'])) {
$requestUri = (string)($_SERVER['REQUEST_URI'] ?? '');
$normalized = page_normalize_url($requestUri);
if ($normalized !== '' && $normalized !== $requestUri) {
header('Location: ' . $normalized, true, 302);
exit;
}
}
define('APP_ROUTE_BOOTSTRAP', true);
set_route_page_context(APP_PAGE);
require __DIR__ . '/index.php';