Force Redirect to SSL with PHP w/ osTicket
Force Redirect to SSL with PHP w/ osTicket
The code below works best on Apache web server. On IIS, you may need to use different variables from $_SERVER. Although the 301 header is optional, you may want to use it for search engine friendliness, as described in Permanent Redirect with HTTP 301
root/index.php
root/scp/index.php
Add code below <?php
if($_SERVER["HTTPS"] != "on") {
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
exit();
}
Comments
Post a Comment