Make WordPress Core

Opened 12 years ago

Last modified 5 years ago

#23088 new defect (bug)

Multisite, Subdomains and www

Reported by: jkhoffman's profile jkhoffman Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Bootstrap/Load Keywords: has-patch needs-refresh
Focuses: multisite Cc:

Description

I installed a WordPress Multisite network (in subdomain mode) on Zend's PHPCloud.com.

Zend does not provide an IP address, recommending a CNAME instead. CNAME records are not allowed on the root of a domain, so they recommend using the www subdomain, with a redirect from the root domain to www.

This site can NEVER be accessed on the naked domain; it will always be accessed via the www subdomain.

So, I setup wildcard DNS for *.mydomain.com, then created a network on www.mydomain.com. Then, I went to a non-existant subdomain on my network, nonexistant.mydomain.com, and WordPress redirected to www.mydomain.com/wp-signup.php?new=nonexistantwwwmydomaincom.

The correct behavior is to redirect to www.mydomain.com/wp-signup.php?new=nonexistant

The fix for this is in wp-includes/ms-settings.php, replace line 89 with:

$site_domain = preg_replace( '|^www\.|', '', $current_site->domain );
$destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $site_domain, '', $domain );

Also, on the registration page at the bottom it says:

"The site you were looking for, http://nonexistant.www.mydomain.com/ does not exist, but you can create it now!"

The fix is in ms-blogs.php, line 53:

$url = preg_replace( '|^([^\.]+://)(?:www\.)?|', '$1' . $blogname . '.', $url );

Attachments (2)

23088.patch (395 bytes) - added by jkhoffman 12 years ago.
23088-2.patch (248 bytes) - added by jkhoffman 12 years ago.

Download all attachments as: .zip

Change History (6)

@jkhoffman
12 years ago

@jkhoffman
12 years ago

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Multisite
  • Version changed from 3.5 to 3.0

Related: #13104

#3 @jeremyfelt
11 years ago

  • Component changed from Multisite to Bootstrap/Load
  • Focuses multisite added

#4 @chriscct7
9 years ago

  • Keywords has-patch needs-refresh added
Note: See TracTickets for help on using tickets.