Modify link to handle servers with odd configurations
This commit is contained in:
parent
443d4ac1f3
commit
30dcb113ae
12
api/Link.php
12
api/Link.php
@ -50,7 +50,17 @@ class Link
|
||||
if ( !empty ( $_SERVER['PATH_INFO'] ) ) {
|
||||
$path = $_SERVER['PATH_INFO'];
|
||||
} else if ( !empty ( $_SERVER['REQUEST_URI'] ) ) {
|
||||
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||
$parts = explode('/', $_SERVER['REQUEST_URI']);
|
||||
$startingIndex = -1;
|
||||
for ($i = count($parts) - 1; $i > -1 && $startingIndex === -1; $i--) {
|
||||
if ($parts[$i] === 'index.php' || $parts[$i] === 'api') {
|
||||
$startingIndex = $i + 1;
|
||||
}
|
||||
}
|
||||
$path = '';
|
||||
for ($i = $startingIndex; $i < count($parts); $i++) {
|
||||
$path .= "/{$parts[$i]}";
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($routes[$path] ) ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user