- Tue 17 October 2017
- Debug
tl;dr: WordPress multisite has misconfiguration resulting in logic bug causing infinite redirect loop.
The Problem
In a wordpress network, the dashboard php file contains the following line
$redirect_network_admin_request = 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path );
This evaluation feeds an if statement which redirects the client on true. The if-statement compares the path and domain of the requested URI against values stored on the server.
The value of current_blog is pulled from the requested URI, the value of current_site are pulled from the wp_blogs table in the associated SQL database (Specifically the blog with ID of 1)
This comparison is sensitive to subdomains! If the domain is www.site.com and the current_site in wp_blogs is site.com the result is a redirect loop.
What would cause the domain to have www. prepended?
These settings right here:
If you have https://www.domain.com, the wordpress site will keep adding www. to your URI.
When you attempt to access the network dashboard - infinite redirect loop.