Redirecting users who use http:// to https://



I have a site that is now SSL secured.

User not still using the http:// to get to the site.

How can I redirect the user the the visited page using https:// ?


With SSL you have the option to make the user to have to type the https:// or
not type it in. However, if you make this required then they will see a
default message that they are missing the https://. Now, for just
redirecting user, its the same way. In your link you could type <a
href="https://... OR, in code you can do a response.redirect("https://...")


You can add code a custom error handler for the 403.4 error. This error
handler can then replace the "http:" with "https:" and redirect the user
using the https.

Here is a sample:

Dim strURL
Dim iPosition

iPosition = InStr(1,Request.querystring,";")
strURL = replace(Mid(Request.QueryString, iPosition + 1), ":80", "")
iPosition = InStr(1,strURL,"http://")
if iposition = 1 then
strURL = "https://" & mid (strURL, 8)
Response.Redirect strURL
Response.Status = "403.4 SSL Required"
end if


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question