The following script will redirect the url from http to https:
|
1 2 3 4 5 |
if($_SERVER['SERVER_PORT'] != 443) { header("HTTP/1.1 301 Moved Permanently"); header("Location: https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); exit(); } |
//Or you can use like following:
|
1 2 3 4 5 |
<code>if($_SERVER["HTTPS"] != "on") { header("HTTP/1.1 301 Moved Permanently"); header("Location: "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); exit(); }</code> |
|
1 2 |
<code>That's it </code> |



