Refactor configuration handling: implement dynamic loading of config and cache paths for improved security and flexibility in Docker environments
This commit is contained in:
1 parent
c7b836bcf2
commit
bb65ecd43c
7 files changed
+53
-12
No files matched your search
@@ -24,4 +24,14 @@ if (preg_match($blocked, $path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Apache (mod_dir) redirects /admin to /admin/; the built-in server just
|
||||
// serves admin/index.php at /admin. Every relative link on that page then
|
||||
// resolves against / instead of /admin/ — "menu.php" lands on the public
|
||||
// menu, "users.php" 404s. Match Apache so dev behaves like production.
|
||||
if ($path !== '/' && !str_ends_with($path, '/') && is_dir(__DIR__ . '/..' . $path)) {
|
||||
$query = parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_QUERY);
|
||||
header('Location: ' . $path . '/' . ($query ? '?' . $query : ''), true, 301);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
Reference in new issue
Block a user