Force SSL usage


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function forceSSL ()
  2. { // force SSL usage and use of WWW
  3. if (($_SERVER["SERVER_PORT"] != 443)) {
  4. header("Location: " . "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
  5. exit();
  6. }
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.