Skip to content

Commit 038cc62

Browse files
committed
fix(envlite): serve directory indexes so /wp-admin/ reaches wp-admin/index.php
Existing directories such as /wp-admin/ previously fell through to the front controller, returning the front-end response instead of executing src/wp-admin/index.php. Return false for directories with an index.php so php -S serves the directory index. Directories without an index still fall through to the front controller to avoid php -S's default directory listings.
1 parent 048bbc6 commit 038cc62

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tools/local-env/router.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@
99
}
1010

1111
$file = dirname(__DIR__, 2) . '/src' . $path;
12-
if ($path !== '/' && file_exists($file) && !is_dir($file)) {
13-
return false;
12+
13+
if ($path !== '/' && file_exists($file)) {
14+
if (!is_dir($file)) {
15+
return false;
16+
}
17+
// Existing directory: let the built-in server serve its index.php
18+
// (e.g. /wp-admin/ -> wp-admin/index.php). Without an index, fall
19+
// through to the front controller to avoid directory listings.
20+
if (file_exists(rtrim($file, '/') . '/index.php')) {
21+
return false;
22+
}
1423
}
24+
1525
require dirname(__DIR__, 2) . '/src/index.php';

0 commit comments

Comments
 (0)