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

View File

@@ -4,10 +4,8 @@ container of your choosing. If using a virtual host, place the directives in the
`/etc/apache2/sites-available/default`.
```apache
#This directive is never put inside a virtual host
AllowEncodedSlashes On
#These directives can be inside a virtual host or in the base server configuration
AllowEncodedSlashes On
Alias /librenms /opt/librenms/html
<Directory "/opt/librenms/html">

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);