WordPress多站点环境下/includes子目录页面404错误求助
/includes Directory Issues After WordPress Multisite Setup Hey James, sorry to hear you're stuck with this odd issue—let's walk through the most likely reasons why your /includes subdirectory pages are failing while regular pages work fine post-multisite setup:
1. .htaccess Rewrite Rule Conflicts
WordPress multisite adds a set of rewrite rules that route most requests to index.php for WP to handle. If /includes is a physical directory on your server, these rules might be overriding direct access to its files.
- First, check if your .htaccess includes conditions to skip existing files and directories. You'll want lines like this before the main multisite rewrite rules:
These tell the server to prioritize real files/directories over WP's routing. If they're missing, adding them should fix the issue.RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - Double-check that the multisite-specific rules (like those starting with
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin/) aren't accidentally targeting the/includespath.
2. Multisite Configuration Missteps (wp-config.php)
Subdirectory-based multisite can sometimes misinterpret physical directories as potential subsite slugs:
- Verify
SUBDOMAIN_INSTALLis set correctly: If you're using subdirectory multisite, it should bedefine( 'SUBDOMAIN_INSTALL', false ); - Make sure
PATH_CURRENT_SITEis set to'/'(unless your main site is in a subdirectory) and that you haven't accidentally registeredincludesas a subsite slug in your network admin. - Check for any custom constants related to rewrite rules or site paths that might be interfering with
/includes.
3. File Permission Changes
Multisite setup processes sometimes adjust file permissions. Ensure:
- The
/includesdirectory has permissions set to755(readable/executable by the server) - Files inside
/includesare set to644(readable by the server) - The server user (e.g.,
www-dataon Apache) owns the directory and files (you can usechowncommands if needed).
4. Plugin/Theme Conflicts
Network-activated plugins or your active theme might be adding conflicting rewrite rules:
- Temporarily deactivate all network-wide plugins and test if
/includespages work. If they do, reactivate plugins one by one to find the culprit. - Switch to a default WordPress theme (like Twenty Twenty-Four) to rule out custom theme code causing the issue.
If you can share sanitized snippets of your .htaccess and wp-config.php files (redact database credentials or sensitive keys), we can pinpoint the exact issue faster.
内容的提问来源于stack exchange,提问作者iwillbeawebdeveloper

