fix: answer 404 for WordPress content directories - #230
Merged
Merged
Conversation
This was referenced Oct 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes Pollora/framework#294.
WordPress ships an empty
index.php("Silence is golden") inwp-content,wp-content/pluginsandwp-content/themes. Withpublic/cms/wp-content/under the document root, Apache served it directly:/cms/wp-content/,/cms/wp-content/index.php,/cms/wp-content/plugins/,/cms/wp-content/themes//content/,/content/plugins/,/content/uploads/Either way a visitor learns the directory exists. #187 removed
content/plugins/index.php, which turned that one into a 403; the core files cannot be removed from the skeleton.These requests never reach Laravel (Apache runs the stub
index.phpitself), so the framework middleware the issue suggested could not intercept them: the fix belongs to the web server configuration.Fix
A rule in
public/.htaccess, before the trailing-slash redirect: undercms/wp-contentandcontent, a directory or anindex.phpgoes to the front controller, which answers with the site's own 404. Files in those directories (plugin CSS/JS, uploads) are served as before.Tests
New install check group
1.9 — Content directories answer 404(php tests/install/run.php checks directories), run in thewebandartisanscenarios: each path above must render the site's 404 page, and a core and a plugin stylesheet must still answer 200.Measured on pollora-test (DDEV, apache-fpm): 8/8 with the rule, 7 failures without it (blank 200s and 403s). Also checked by hand: a WooCommerce stylesheet, an upload, a Vite build file,
wp-login.php,wp-admin/, the home page and the shop are unaffected.Nginx is not covered by this file;
server-configuration.mdwill be updated with the release.