Loading

Redirect http to https PH

  1. <?php
  2. if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
  3.     $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  4.     header('HTTP/1.1 301 Moved Permanently');
  5.     header('Location: ' . $redirect);
  6.     exit();
  7. }
  8. ?>