Allow for setup in sub-directory, should fix #53

This commit is contained in:
bohwaz 2024-03-22 18:21:04 +01:00
parent 73268cb0d1
commit c24e0c34e8

View file

@ -5,6 +5,9 @@ namespace KaraDAV;
require_once __DIR__ . '/_inc.php';
$uri = parse_url($_SERVER['REQUEST_URI'], \PHP_URL_PATH);
$base_uri = parse_url(WWW_URL, \PHP_URL_PATH);
$uri = '/' . ltrim(substr($uri, strlen($base_uri)), '/');
$s = new Server;
@ -50,7 +53,7 @@ if (!$s->route($uri)) {
}
http_response_code(404);
echo '<h1>Invalid URL</h1>';
echo '<h1>Page not found</h1>';
}
elseif (LOG_FILE) {
http_log("ROUTER: => %d\nResponse headers:\n %s", http_response_code(), implode("\n ", headers_list()));