Opened 5 years ago
Last modified 5 years ago
#47630 new defect (bug)
Multisite: Admin dashboard links are malfunctioning on mapped domain
Reported by: | kalico | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | blocker | Version: | 5.2.2 |
Component: | Networks and Sites | Keywords: | |
Focuses: | administration, multisite | Cc: |
Description
I realize this may not qualify as a Trac issue. However, I have already tried the wp support forums, and read multiple pages of the wp forums, codex, stack exchange, etc. No one has an explanation for what I'm seeing, nor even do I find a similar description of it anywhere.
Bottom line:
Domain mapping on admin dashboard is not working as expected. The default (un-mapped) dashboard link for any mapped domain takes me to the primary site's dashboard. The mapped domain dashboard link takes me to a login screen.
Background:
About 10 days ago, out of the blue, “something” failed miserably on my production site. The primary symptom was that sites with a mapped domain were in a redirect loop on the front end.
I had not done any updates or made any changes to the site. There were other symptoms at first, seemed causative. In retrospect, they may have been resultant or coincidental. I can explain if it is of interest, but I am trying to keep this brief.
I was using the WPMUDEV Domain Mapping plugin, and it had been in place since the development of the site 3 years ago. I got the site working again by reverting to standard built-in WP domain mapping. However, the admin toolbar was missing (not the issue I am reporting today) and links to the mapped domain dashboards were malfunctioning.
In my research, I have learned that some people who were using the MU Domain Mapping plugin (a different domain mapping plugin than I was using) experienced very similar issues around the same time. They also reported missing toolbars and redirect loops.
For troubleshooting purposes, I created an exact duplicate of my production site with a primary domain of dev.xxxxxxxxxx.org and a mapped domain of dev.yyyy.org
I assumed that I could work through a plugin conflict test and find out the cause. But after stripping the site down to bare bones, I still have the same problem.
I cannot say for sure that it is a bug -- it may very well be something with my site. But I simply do not know where else to turn at this point. I need advice from those who know domain mapping best and might be able to identify what the root cause of this problem is.
You can see a screencast demonstrating the problem here:
You can see screenshots of my folder structure and database entries here:
Here are my site specs:
- Multisite
- WP 5.2.2 ( was on 5.1 with several out of date plugins when the original "out of the blue" problem happened and updated to 5.2.2 during troubleshooting)
- AWS hosting
- Apache/2.4.18 (Ubuntu)
- PHP 7.0.33-0ubuntu0.16.04.5
- multisite is in the webroot
- subdirectory multisite setup
- All plugins, mu-plugins, and drop-in plugins are moved into temp folders.
- All sites are set to Twenty-Nineteen theme.
- Domain mapping (using wp in-built options) for two domains, mapped to two of the subsites
- On the frontend, domain mapping works as expected.
- In the dashboard, domain mapping is NOT working correctly.
– it was originally set up with the WPMUDEV Domain Mapping plugin (which is now legacy b/c of domain mapping since wp 4.5)
– auto updates disabled
I expect:
My Sites >> [Mapped Site] >> Dashboard
- should take me to the dashboard for that site (not any other)
- I should not need to login because I am already logged in as superadmin
What happens:
My Sites >> [Mapped Site] >> Dashboard
- I am taken to a login screen and my superadmin login returns a "wrong email or password" error
- If I manually change the URL to the non-mapped URL for the dashboard (primarydomain.com/zzzzz/wp-admin), I am immediately taken to the primary site's dashboard instead.
There is no 301/302 redirect.
There are no errors in the apache error log.
There are no errors in the WP debug log.
The browser console shows no errors.
I have tested this by creating a new sub-site and mapping the domain there instead. When I do this, the newly created test site's dashboard is inaccessible, and I am taken to the primary domain's dashboard. Now I can get to the previously mapped domain's dashboard easily, via the My Sites menu. This is demonstrated in the screencast above.
Relevant portions of wp-config:
/* Multisite */ define( 'WP_ALLOW_MULTISITE', true ); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'dev.xxxxxxxxxx.org'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); // define('COOKIE_DOMAIN', ''); // define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']); // define('DOMAINMAPPING_ALLOWMULTI', true); // define('FORCE_SSL_ADMIN', true); /* these were recommended for fixing a redirect loop, but they are not helping now */ // define('ADMIN_COOKIE_PATH', '/'); // define('COOKIE_DOMAIN', ''); // define('COOKIEPATH', ''); // define('SITECOOKIEPATH', ''); /* baseline home and siteurl */ define( 'WP_HOME', 'https://dev.xxxxxxxxxx.org' ); define( 'WP_SITEURL', 'https://dev.xxxxxxxxxx.org' );
Relevant portions of .htaccess:
(Keep in mind this is a copy of my production site, which does not have dev. in front of the domain name. Since the problem exists in both places identically, and given the use of the domain in these functions, I do not think it is relevant. Please correct me if I am wrong.)
# BEGIN HTTPS Redirection Plugin <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> # END HTTPS Redirection Plugin # Stop spam attack logins and comments <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .*/(wp-comments-post|wp-login)\.php.* [OR] RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ [OR] RewriteCond %{REQUEST_URI} ^(.*)?log-in(.*)$ RewriteCond %{HTTP_REFERER} !.*xxxxxxxxxx.org.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ #RewriteRule (.*) http://%{REMOTE_ADDR}/$1 [R=301,L] RewriteRule ^(.*)$ - [F] #RewriteRule ^(.*)$ http://xxxxxxxxxx.org/misc/block.html [R=301,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteRule ^index\.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] </IfModule> # END WordPress
I will be very grateful for any assistance you can provide in determining if there is something wrong with my site, or if this is a bug in WP. Thank you in advance!
For what it's worth, I have started over completely from scratch: empty database, fresh install of WP, upgraded it to MU, and mapped a domain. Still having difficulties. The mapped domain doesn't do the weird admin redirect described above, but I can't get past the login screen.
http://dev2.nroc.org/wp-admin
redirects me to
https://dev2.nroc.org/wp-login.php?redirect_to=https%3A%2F%2Fdev2.nroc.org%2Fwp-admin%2F&reauth=1
and my superadmin login does not work there.
https://wordpress.org/support/article/wordpress-multisite-domain-mapping/ >> Map Domains in DNS
gives this cryptic and technically inaccurate description of how to point mapped domains to the server.
Make sure all the domains you want to use are already mapped to your DNS server. The additional domains should be parked upon the master domain.
We do have two domains resolving to our AWS server, and both of them DO bring up the proper website when mapped:
dev2.nrocnetwork.org >> primary site
dev2.nroc.org >> secondary site located at dev2.nrocnetwork.org/nroc
But in admin it's a different story.
dev2.nrocnetwork.org/wp-admin >> primary site dashboard (GOOD)
dev2.nroc.org/wp-admin >> login screen (redirect described above).
We decided to try a different DNS configuration. We changed from A record to CNAME as follows:
was:
dev2.nroc.org - A - 54.xxx.xxx.xxx
and now:
dev2.nroc.org - CNAME - dev2.nrocnetwork.org
But that didn't fix the problem.
Any help at all would be greatly appreciated. Perhaps something is missing from the instructions? or our server is configured wrong? I really don't want to go back to a domain mapping plugin if wp core has this capabilty built in.
Thanks.