diff --git a/src/App.php b/src/App.php index 0ee5de37ba..8478077af8 100644 --- a/src/App.php +++ b/src/App.php @@ -673,13 +673,11 @@ public function url($page = [], array $extraRequestUrlArgs = []): string if ($pagePath === '') { // TODO path must always start with '/' $pagePath = '/'; } - if (substr($pagePath, -1) === '/') { - $pagePath = $this->urlBuildingIndexPage; - } else { - $pagePath = basename($pagePath, $this->urlBuildingExt); - } } - if (!str_contains(basename($pagePath), '.')) { + if (str_ends_with($pagePath, '/')) { + $pagePath .= $this->urlBuildingIndexPage; + } + if (!str_ends_with($pagePath, '/') && !str_contains(basename($pagePath), '.')) { $pagePath .= $this->urlBuildingExt; }