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' );