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
Christoph M. Becker 497e577846 Allow to access symlinked docs
Since `realpath()` resolves links, symlinked docs as suggested by the
"Setting up Documentation environment" page[1] are incompatible with
the router script.  Of course, the Webserver can be run without the
router script, but in that case shortcuts (e.g. `/json_decode`) won't
work.

Thus, we remove the `realpath()` resolution.  There is no more need
for the `strncmp()` check.  This suggest that we can get rid of the
`$afilename` and `$len` variables; hopefully, they are not used by any
of the included files.

[1] <http://doc.php.net/tutorial/local-setup.php>
2020-12-11 20:50:15 +01:00

13 lines
371 B
PHP

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