From 3dec5d7aaff581bda1d25f82e30b077f1db53dad Mon Sep 17 00:00:00 2001 From: Romans Malinovskis Date: Sun, 3 Dec 2017 21:55:25 +0000 Subject: [PATCH] fix url() when used on `index.php`, #279 --- src/App.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/App.php b/src/App.php index b3d140434c..eca441a13b 100644 --- a/src/App.php +++ b/src/App.php @@ -404,7 +404,13 @@ public function url($page = [], $needRequestUri = false) $result = []; if ($this->page === null) { - $this->page = basename($this->getRequestURI(), '.php'); + $uri = $this->getRequestURI(); + + if (substr($uri, -1, 1) == '/') { + $uri .= 'index.php'; + } + + $this->page = basename($uri, '.php'); } // if page passed as string, then simply use it