WordPress.org

Make WordPress Core

Changeset 28610


Ignore:
Timestamp:
05/29/2014 04:12:05 AM (5 years ago)
Author:
nacin
Message:

Force SSL on the frontend via canonical when the home URL uses the https scheme.

fixes #27954.

File:
1 edited

Legend:

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

    r28215 r28610  
    341341        unset($redirect['port']);
    342342
     343    if ( ! empty( $user_home['scheme'] ) && $user_home['scheme'] === 'https' ) {
     344        $redirect['scheme'] = 'https';
     345    }
     346
    343347    // trailing /index.php
    344348    $redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
     
    398402        $redirect['host'] = $original['host'];
    399403
    400     $compare_original = array($original['host'], $original['path']);
     404    $compare_original = array( $original['scheme'], $original['host'], $original['path'] );
    401405
    402406    if ( !empty( $original['port'] ) )
     
    406410        $compare_original[] = $original['query'];
    407411
    408     $compare_redirect = array($redirect['host'], $redirect['path']);
     412    $compare_redirect = array( $redirect['scheme'], $redirect['host'], $redirect['path'] );
    409413
    410414    if ( !empty( $redirect['port'] ) )
Note: See TracChangeset for help on using the changeset viewer.