Issue #2970132 by neerajsingh, webflo: .ht.router.php causes a redirect loop when invoked from parent directory

merge-requests/1654/head
Alex Pott 2018-05-09 08:32:57 +01:00
parent 154f282899
commit 4ed1bcf646
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@
*/
$url = parse_url($_SERVER['REQUEST_URI']);
if (file_exists('.' . $url['path'])) {
if (file_exists(__DIR__ . $url['path'])) {
// Serve the requested resource as-is.
return FALSE;
}
@ -38,7 +38,7 @@ if (strpos($path, '.php') !== FALSE) {
// fallback to index.php.
do {
$path = dirname($path);
if (preg_match('/\.php$/', $path) && is_file('.' . $path)) {
if (preg_match('/\.php$/', $path) && is_file(__DIR__ . $path)) {
// Discovered that the path contains an existing PHP file. Use that as the
// script to include.
$script = ltrim($path, '/');