Skip to content

Commit 7c70ebb

Browse files
authored
Update force-https.php
1 parent d161a65 commit 7c70ebb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

force-https.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@
2727
return $overrides;
2828
}, 999 );
2929

30-
// force https redirection for all non-https requests
30+
// force https on frontend requests
3131
add_action( 'init', 'force_https_redirect_non_https', 10 );
3232
function force_https_redirect_non_https() {
3333
if ( ! is_ssl() && ! is_admin() && PHP_SAPI !== 'cli' ) {
3434
if ( ! headers_sent() ) {
35-
$redirect_url = home_url( add_query_arg( array(), null ) );
36-
wp_safe_redirect( set_url_scheme( $redirect_url, 'https' ), 301 );
35+
wp_safe_redirect( set_url_scheme( home_url( $_SERVER['REQUEST_URI'] ), 'https' ), 301 );
3736
exit;
3837
}
3938
}

0 commit comments

Comments
 (0)