WordPress多站点子站点后台无法登录(MU域名映射插件限制)
Hey, I’ve dealt with this exact problem before—MU Domain Mapping’s root directory restriction can be a real pain on virtual servers. Let’s break down how to get your mapped sub-site logins working:
1. Tweak Your wp-config.php Multisite Settings
You already have the base Multisite defines, but we need to add/modify a few lines to play nice with non-root installs:
- Double-check
DOMAIN_CURRENT_SITEis set to your main site’s root domain (e.g.,define('DOMAIN_CURRENT_SITE', 'your-main-domain.com');) - Add the
PATH_CURRENT_SITEdefine pointing to your WordPress install path (if it’s not in/). For example, if WP is in/blog, use:define('PATH_CURRENT_SITE', '/blog/'); - Add these two lines to lock in the default site IDs (they’re almost always 1 for the main site):
define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
2. Update Your .htaccess Rules for Non-Root
MU Domain Mapping relies on correct rewrite rules, and the default Multisite rules don’t work for non-root paths. Backup your existing .htaccess first, then replace it with this (swap /your-wp-folder/ with your actual install path):
RewriteEngine On RewriteBase /your-wp-folder/ RewriteRule ^index\.php$ - [L] # Skip real files/directories RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] # Route all requests to index.php (supports domain mapping) RewriteRule ^(.*)$ /your-wp-folder/index.php [L]
3. Adjust MU Domain Mapping Plugin Settings
Head to your main site’s admin panel, go to the Domain Mapping settings page:
- Check the box for Permanent redirect (better for your blogger's pagerank) to ensure clean domain routing
- Fill in the Server IP Address field (you can grab this from your hosting control panel) — this fixes resolution issues on some virtual hosts
- For each mapped sub-site, make sure the custom domain is added and set as the Primary domain
4. Verify Hosting Domain Bindings
Virtual servers often restrict domain bindings to specific directories:
- In your hosting control panel (like cPanel), check that your mapped domain (the one for the sub-site) is set to point to your WordPress install directory (not the server root)
- If using addon domains, confirm the document root matches your WP folder path
After making these changes, clear your WordPress cache (if you use a caching plugin) and your browser cache, then test logging into the mapped sub-site. If you still run into issues, try disabling other plugins temporarily to rule out conflicts—sometimes security or caching plugins interfere with domain mapping.
内容的提问来源于stack exchange,提问作者Umakant infris

