Single Page WordPress SSL Redirect

A non .htaccess way to force a SSL on a single page in WordPress

1
2
3
4
5
6
7
8
function secure_page() {
 
if (!is_page('registration')) { return; }
 
      if($_SERVER['SERVER_PORT'] != '443') { header('Location: https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); }
 
}
add_action( 'template_redirect', 'secure_page' );
Comments