WordPress.org

Make WordPress Core

Ticket #21602: 21602.patch

File 21602.patch, 1.5 KB (added by SergeyBiryukov, 20 months ago)
  • wp-includes/canonical.php

     
    374374        if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) ) 
    375375                $redirect['path'] = trailingslashit($redirect['path']); 
    376376 
    377         // Ignore differences in host capitalization, as this can lead to infinite redirects 
    378         // Only redirect no-www <=> yes-www 
    379         if ( strtolower($original['host']) == strtolower($redirect['host']) || 
    380                 ( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) ) 
    381                 $redirect['host'] = $original['host']; 
    382  
    383377        $compare_original = array($original['host'], $original['path']); 
    384378 
    385379        if ( !empty( $original['port'] ) ) 
     
    396390        if ( !empty( $redirect['query'] ) ) 
    397391                $compare_redirect[] = $redirect['query']; 
    398392 
     393        // Ignore differences in host capitalization, as this can lead to infinite redirects 
     394        // Only redirect no-www <=> yes-www 
     395        if ( strtolower($original['host']) == strtolower($redirect['host']) || 
     396                ( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) ) 
     397                $redirect['host'] = $original['host']; 
     398 
    399399        if ( $compare_original !== $compare_redirect ) { 
    400400                $redirect_url = $redirect['scheme'] . '://' . $redirect['host']; 
    401401                if ( !empty($redirect['port']) )