1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 16:26:59 +02:00
This commit is contained in:
Ryan Cramer
2023-02-14 08:57:09 -05:00
parent 0f6cd3c148
commit a1a72e5ca3

View File

@@ -11,7 +11,7 @@
* ~~~~~
* #pw-body
*
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
* ProcessWire 3.x, Copyright 2023 by Ryan Cramer
* https://processwire.com
*
* @method Page|NullPage getPage()
@@ -301,15 +301,16 @@ class PagesRequest extends Wire {
// populate request path to class as other methods will now use it
$this->setRequestPath($path);
// determine if index.php is referenced in URL
if(stripos($this->dirtyUrl, 'index.php') !== false && stripos($path, 'index.php') === false) {
// determine if original URL had anything filtered out of path that will suggest a redirect
list($dirtyUrl,) = explode('?', "$this->dirtyUrl?", 2); // exclude query string
if(stripos($dirtyUrl, 'index.php') !== false && stripos($path, 'index.php') === false) {
// force pathFinder to detect a redirect condition without index.php
$path = rtrim($path, '/') . '/index.php';
} else if(strpos($this->dirtyUrl, '//') !== false) {
$dirtyUrl = strtolower(rtrim($dirtyUrl, '/'));
if(substr("/$dirtyUrl", -10) === '/index.php') $path = rtrim($path, '/') . '/index.php';
} else if(strpos($dirtyUrl, '//') !== false) {
// force pathFinder to detect redirect sans double slashes, /page/path// => /page/path/
list($dirtyUrl,) = explode('?', "$this->dirtyUrl?", 2); // exclude query string
if(strpos($dirtyUrl, '//') !== false) $path = rtrim($path, '/') . '//';
$path = rtrim($path, '/') . '//';
}
// get info about requested path