Advertisement
rajudhaka

Force to use SSL Wordpress

Jul 22nd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.25 KB | None | 0 0
  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 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement