From 53e9eaa5e438e721da1b8fd3cb06aa1248442879 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Tue, 18 Jul 2017 21:31:14 +0200 Subject: [PATCH] Fix Pico's REQUEST_URI routing method when installed to / --- lib/Pico.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Pico.php b/lib/Pico.php index 0615217..e15f1e8 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -965,7 +965,8 @@ class Pico // use REQUEST_URI (requires URL rewriting); e.g. /pico/sub/page if (($this->requestUrl === null) && $this->isUrlRewritingEnabled()) { - $basePath = dirname($_SERVER['SCRIPT_NAME']) . '/'; + $basePath = dirname($_SERVER['SCRIPT_NAME']); + $basePath = !in_array($basePath, array('.', '/')) ? $basePath . '/' : '/'; $basePathLength = strlen($basePath); $requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';