Opened 12 years ago
Last modified 5 years ago
#23088 new defect (bug)
Multisite, Subdomains and www
Reported by: | 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 );
Related: #13104