How can I force users to access my page over HTTPS instead of HTTP?

The way I’ve done it before is basically like what you wrote, but doesn’t have any hardcoded values:if($_SERVER[“HTTPS”] != “on”) { header(“Location: https://” . $_SERVER[“HTTP_HOST”] . $_SERVER[“REQUEST_URI”]); exit(); }

Leave a Comment