WordPress.org

Make WordPress Core

Changeset 6112


Ignore:
Timestamp:
09/13/2007 07:24:05 PM (11 years ago)
Author:
markjaquith
Message:

Handle ports for canonical redirects. Props driverkt and westi. fixes #4970

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/canonical.php

    r6111 r6112  
    106106    $redirect['host'] = $user_home['host'];
    107107
     108    // Handle ports
     109    if ( isset($user_home['port']) )
     110        $redirect['port'] = $user_home['port'];
     111    else
     112        unset($redirect['port']);
     113
    108114    // trailing /index.php or /index.php/
    109115    $redirect['path'] = preg_replace('|/index.php/?$|', '/', $redirect['path']);
     
    137143        $redirect['host'] = $original['host'];
    138144
    139     if ( array($original['host'], $original['path'], $original['query']) !== array($redirect['host'], $redirect['path'], $redirect['query']) ) {
    140         $redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
     145    if ( array($original['host'], $original['port'], $original['path'], $original['query']) !== array($redirect['host'], $redirect['port'], $redirect['path'], $redirect['query']) ) {
     146        $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
     147        if ( isset($redirect['port']) )
     148            $redirect_url .= ':' . $redirect['port'];
     149        $redirect_url .= $redirect['path'];
    141150        if ( $redirect['query'] )
    142151            $redirect_url .= '?' . $redirect['query'];
Note: See TracChangeset for help on using the changeset viewer.