From dbb012bdaf46b882f71511a9f0ab5a296a76fb94 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Wed, 12 Nov 2008 21:27:19 +0000 Subject: [PATCH] Canonical now only redirects to a different domain if the domains differ by their yes-www/no-www status. fixes #5089 git-svn-id: http://svn.automattic.com/wordpress/trunk@9646 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 728b1dda9..7e10c9183 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -238,7 +238,9 @@ function redirect_canonical($requested_url=null, $do_redirect=true) { $redirect['path'] = trailingslashit($redirect['path']); // Ignore differences in host capitalization, as this can lead to infinite redirects - if ( strtolower($original['host']) == strtolower($redirect['host']) ) + // Only redirect no-www <=> yes-www + if ( strtolower($original['host']) == strtolower($redirect['host']) || + ( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) ) $redirect['host'] = $original['host']; $compare_original = array($original['host'], $original['path']);