SHARE
TWEET

Force to use SSL Wordpress

rajudhaka Jul 22nd, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // add this to functions.php file
  2. function toz_force_https () {
  3.   if ( !is_ssl() ) {
  4.     wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
  5.     exit();
  6.   }
  7. }
  8. add_action ( 'template_redirect', 'toz_force_https', 1 );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top