Skip to content

Instantly share code, notes, and snippets.

@kaushalp
Created May 8, 2017 14:34
Show Gist options
  • Save kaushalp/7449b8c7c0e5545be91903f7606764dd to your computer and use it in GitHub Desktop.
Save kaushalp/7449b8c7c0e5545be91903f7606764dd to your computer and use it in GitHub Desktop.
HTTP to HTTPS Redirect using ASP
<%
If Request.ServerVariables("HTTPS") = "off" Then
Response.Redirect "https://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("UNENCODED_URL")
ElseIf Request.ServerVariables("HTTPS") = "on" Then
Response.Redirect "https://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("UNENCODED_URL")
End If
%>
@MatthewNinety
Copy link

I don't understand the Else If on line 4. Both redirect commands, line 3 and line 5, are identical. Why would you do an else or an elseif to execute the same command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment