## redirect с http на https | |
add_action('init', 'http_to_https_redirect'); | |
function http_to_https_redirect(){ | |
if( is_ssl() ) return; | |
if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) | |
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ), 301 ); | |
else | |
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 ); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment