From bd04c03c9f5fe0d1ff458fe117aba9b8fd18ed95 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 11 Jul 2018 22:23:57 -0400 Subject: [PATCH] Fix urlpath determination on the root page --- src/App.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/App.php b/src/App.php index 3ce5bf576c..8bde1afc43 100644 --- a/src/App.php +++ b/src/App.php @@ -442,8 +442,14 @@ class App * * To get /path/to/friendica we perform dirname() for as many levels as there are slashes in the QUERY_STRING */ - if (!empty($_SERVER['SCRIPT_URL']) && !empty($_SERVER['QUERY_STRING'])) { - $path = trim(dirname($_SERVER['SCRIPT_URL'], substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/'); + if (!empty($_SERVER['SCRIPT_URL'])) { + // Module + if (!empty($_SERVER['QUERY_STRING'])) { + $path = trim(dirname($_SERVER['SCRIPT_URL'], substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/'); + } else { + // Root page + $path = trim($_SERVER['SCRIPT_URL'], '/'); + } if ($path && $path != $this->urlpath) { $this->urlpath = $path;