1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00
Files
archived-web-php/.router.php
Andreas Möller ede0692b3e Enhancement: Expose happy path (#406)
* Enhancement: Expose happy path

* Fix: Require file with absolute path

* Fix: Return null instead of false
2023-12-06 18:31:09 +00:00

15 lines
357 B
PHP

<?php
$_SERVER["SERVER_ADDR"] = $_SERVER["HTTP_HOST"];
$filename = $_SERVER["PATH_INFO"] ?? $_SERVER["SCRIPT_NAME"];
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . $filename)) {
require_once __DIR__ . '/error.php';
return;
}
/* This could be an image or whatever, so don't try to compress it */
ini_set("zlib.output_compression", 0);
return null;