[wp-trac] [WordPress Trac] #31507: Error determined blog when using multi-site, a domain different than the current site, and more than 1 path segment
WordPress Trac
noreply at wordpress.org
Mon Mar 2 21:59:14 UTC 2015
#31507: Error determined blog when using multi-site, a domain different than the
current site, and more than 1 path segment
--------------------------------+-----------------------------
Reporter: iotr | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version: 4.1
Severity: normal | Keywords:
Focuses: multisite |
--------------------------------+-----------------------------
== Steps to Reproduce ==
1. Create a multi-site blog with SUBDOMAIN_INSTALL set to false and
PATH_CURRENT_SITE set to /content/. Main site is now available at
(http://www.example.com/content/)
2. Create a new network with a different domain name than the domain for
the current site (my.example.com)
3. Set the path for the new network to have 2 path segments, for example
/content/my-new-network
**Expectation** Navigating to http://my.example.com/content/my-new-network
will show the new network
**Result** Redirection back to the primary site
(http://www.example.com/content/) because no blog could be found at the
path
== More Details ==
We have a multi-site blog set up in a similar manner to the description
above. The primary site is based at http://www.elocal.com/content/ and is
configured in wp-config.php like:
{{{#!php
define( 'DOMAIN_CURRENT_SITE', 'www.elocal.com' );
define( 'PATH_CURRENT_SITE', '/content/' );
define( 'SUBDOMAIN_INSTALL', false );
}}}
We then have a few networks. Some of these are under the domain
www.elocal.com (e.g. http://www.elocal.com/content/home-expert-network/ )
while some are under other domains (e.g.
http://www.elocallawyers.com/content/legal-resource-network/ ).
Upon upgrading from WordPress 3.7.1 to Wordpress 4.1.1, we found all of
the blogs NOT on the same domain as the primary site (so not on
www.elocal.com) no longer could be located, navigating to the links just
resulted in a 302 back to the main blog page.
Upon researching the issue, I found the code responsible for looking up
the appropriate blog from is restricting the lookup to only the first path
segment source:trunk/src/wp-includes/ms-settings.php?rev=28934#L65 (the
third argument to get_site_by_path is 1. So because the path for the blog
on domain www.elocallawyers.com with two path segments (content and legal-
resource-network), but we are limiting the path to only one path segment
(/, or /content/), we cannot find the blog.
I was able to perform a temporary workaround by changing the third
argument to a 2, which at least got me back up and running.
I'm not sure what a great solution would be. A couple of options that I
can think of:
1. Do not restrict the number of page segments for non current_site blog
lookups
2. Allow for this to be a configuration setting so I could set the maximum
number of lookups.
3. Use the same number of content segments as you would for a blog on the
main site. That is 1 more than the number of segments for the main blog.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31507>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list