check for sites where there is no subdirectory

This commit is contained in:
Michael Newton
2015-08-11 14:22:20 -07:00
parent 6ea5b88025
commit 2267e371b9
2 changed files with 8 additions and 5 deletions
+7 -2
View File
@@ -11,9 +11,14 @@ foreach ($_GET as $key => $get_var) {
}
}
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
$base_url = parse_url($config["base_url"]);
$segments = explode('/', trim(str_replace($base_url["path"], "", $_SERVER['REQUEST_URI']), '/'));
// don't parse the subdirectory, if there is one in the path
if (strlen($base_url["path"]) > 1) {
$segments = explode('/', trim(str_replace($base_url["path"], "", $_SERVER['REQUEST_URI']), '/'));
}
else {
$segments = explode('/', trim($_SERVER['REQUEST_URI'], '/'));
}
foreach ($segments as $pos => $segment) {
$segment = urldecode($segment);