Canonical now only redirects to a different domain if the domains differ by their yes-www/no-www status. fixes #5089

git-svn-id: https://develop.svn.wordpress.org/trunk@9646 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2008-11-12 21:27:19 +00:00
parent 1feb7f4ffb
commit f9e9676597
1 changed files with 3 additions and 1 deletions

View File

@ -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']);