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

fixes #27954.

Built from https://develop.svn.wordpress.org/trunk@28610


git-svn-id: http://core.svn.wordpress.org/trunk@28434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-05-29 04:13:13 +00:00
parent d29dc48134
commit 801df52e51

View File

@ -340,6 +340,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
else
unset($redirect['port']);
if ( ! empty( $user_home['scheme'] ) && $user_home['scheme'] === 'https' ) {
$redirect['scheme'] = 'https';
}
// trailing /index.php
$redirect['path'] = preg_replace('|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path']);
@ -397,7 +401,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
( 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']);
$compare_original = array( $original['scheme'], $original['host'], $original['path'] );
if ( !empty( $original['port'] ) )
$compare_original[] = $original['port'];
@ -405,7 +409,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
if ( !empty( $original['query'] ) )
$compare_original[] = $original['query'];
$compare_redirect = array($redirect['host'], $redirect['path']);
$compare_redirect = array( $redirect['scheme'], $redirect['host'], $redirect['path'] );
if ( !empty( $redirect['port'] ) )
$compare_redirect[] = $redirect['port'];