Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#16328 closed defect (bug) (invalid)

Auto redirect to home when www is in the URL in MU

Reported by: lelandmcfarland's profile lelandmcfarland Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.4
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

I have come across a problem on my MU installation where my primary blog will automatically redirect to the home page when www is in the URL and a virtual subfolder is being called.

Ex. http://www.domain.com/virtual_subfolder/ would redirect to http://domain.com/.

This problem does not effect the domains that I added on with MU, only the primary site is effected.

Attachments (1)

ms-settings.diff (859 bytes) - added by macbis 13 years ago.

Download all attachments as: .zip

Change History (6)

#1 @lelandmcfarland
13 years ago

Here is a little more information about the bug. The reason that this bug does not effect the addon domains is because sunshine.php handles setting the variable $current_blog and $current_site. So because the primary domain is not in the table wp_domain_mapping, those variables are set on line 51 of wp-includes/ms-settings.php and then it verifies on line 97 that the value seeing if the domain column in the wp_blogs table matches the variable $_SERVER[ 'HTTP_HOST' ]. If do not match, such as when a user has www in the domain, Wordpress will redirect to the user to the path given in the path column in the wp_blogs table instead of the requested URL. I hope this helps gives some direction to the problem.

@macbis
13 years ago

#2 @macbis
13 years ago

  • Cc macbis added

I think I'm experiencing the same issue, though in my case http://domain.com/virtual_subfolder/ is redirecting to http://www.domain.com. I'm attaching a patch to ms-settings.php that seems to fix the issue in the hopes that it points someone in the right direction.

#3 @SergeyBiryukov
13 years ago

  • Keywords has-patch added

#4 @wpmuguru
12 years ago

  • Keywords close added

This sounds as though the network was created without the www and then switched to the www after the fact.

The correct way to have this work is change your siteurl & home to www.domain.com before creating the network. I've only ever seen this situation occur when the url of the main site was changed after the network was created.

#5 @jeremyfelt
11 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Severity changed from major to normal
  • Status changed from new to closed

This seems specific to either how WPMU Domain Mapping was configured at the time the ticket was opened and, as wpmuguru mentioned, how the network was originally setup.

If this redirect triggers, we know there was a subfolder network with a matching domain and that there was no site (blog) on that network with a matching path. At this point, we redirect back to the primary site on the network rather than attempt to guess further. If sunrise has been used to take over some of the $current_site and $current_blog setup, then it should probably take care of all of it or set things up in a way that core can continue to handle as normal.

Closing as invalid, feel free to reopen with additional details.

Note: See TracTickets for help on using tickets.