-
-
Save billerickson/424dd8e120292ac4f9aa99a27ffbd788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Force SSL on WPEngine install | |
* | |
* @author Bill Erickson | |
* @see https://www.billerickson.net/force-ssl-on-wpengine | |
* | |
*/ | |
function be_force_ssl_on_wpengine() { | |
if( strpos( home_url(), 'wpengine' ) && ! is_ssl() ) { | |
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 ); | |
exit(); | |
} | |
} | |
add_action( 'template_redirect', 'be_force_ssl_on_wpengine' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment