Skip to content

Commit dd1997e

Browse files
committed
Fixed issue related with subfolders.
1 parent f7dfc53 commit dd1997e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Router.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,13 @@ public function run(): void
314314
}
315315

316316
if ($foundRoute === false) {
317+
$this->response()->setStatusCode(Response::HTTP_NOT_FOUND);
317318
$this->routerCommand()->sendResponse(
318319
call_user_func($this->notFoundCallback, $this->request(), $this->response())
319320
);
320321
}
321322
} catch (Exception $e) {
323+
$this->response()->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);
322324
if ($this->debug) {
323325
die("Fatal error: Uncaught {$e}");
324326
}
@@ -632,6 +634,11 @@ protected function setPaths(array $params): void
632634
$this->baseFolder = rtrim($params['base_folder'], '/');
633635
}
634636

637+
$basePath = str_replace($this->request()->server->get('DOCUMENT_ROOT'), '', $this->baseFolder);
638+
if (($baseFolder = $this->clearRouteName($basePath)) !== '/') {
639+
$this->baseFolder = $baseFolder;
640+
}
641+
635642
if (isset($params['main_method'])) {
636643
$this->mainMethod = $params['main_method'];
637644
}

0 commit comments

Comments
 (0)