Forzar el redireccionamiento de HTTP a HTTPS
En JSP:
<%
if (!request.isSecure()){
response.sendRedirect("https://"+ request.getServerName() + "/" + request.getRequestURI());
}
%>
En PHP:
<?php
if($_SERVER["HTTPS"] != "on") {
header("HTTP/1.1 301 Moved Permanently");
header("Location: "https://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
exit();
}
?>
En ASP:
<%
if Request.ServerVariables("HTTPS") = "off" then
srvname = Request.ServerVariables("SERVER_NAME")
scrname = Request.ServerVariables("SCRIPT_NAME")
response.redirect("https://" & srvname & scrname)
end if
'codigo seguro aqui
%>