mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 17:54:44 +02:00
Fix trailing slash redirect issue with path hooks @bernhardbaumrock
This commit is contained in:
@@ -839,6 +839,7 @@ class WireHooks {
|
|||||||
$filters = array();
|
$filters = array();
|
||||||
$path = trim($path);
|
$path = trim($path);
|
||||||
$pathParts = explode('/', trim($path, '/'));
|
$pathParts = explode('/', trim($path, '/'));
|
||||||
|
$key = null;
|
||||||
|
|
||||||
foreach($pathParts as $index => $filter) {
|
foreach($pathParts as $index => $filter) {
|
||||||
|
|
||||||
@@ -869,6 +870,9 @@ class WireHooks {
|
|||||||
$filters[$key] = $filter;
|
$filters[$key] = $filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// trailing slash on last filter is optional
|
||||||
|
if($key !== null) $filters[$key] = rtrim($filters[$key], '/');
|
||||||
|
|
||||||
$this->pathHooks[$id] = array(
|
$this->pathHooks[$id] = array(
|
||||||
'match' => $path,
|
'match' => $path,
|
||||||
'filters' => $filters,
|
'filters' => $filters,
|
||||||
|
Reference in New Issue
Block a user