Is there any way I can redirect certain pages from https to http without hard coding all my links? I think a lot of people are going to the checkout page on our shopping cart (which is https), then clicking on another link and getting stuck in https the rest of the time their browsing. If you go to https://www.google.com it automatically redirects you to a non ssl page. Anyone know how to do this? Site is on classic asp if it matters.
You can check if your user is on https or not with
Code:
Request.ServerVariables("HTTPS")
It will return on or off.
If it is and it shouldn't be, just redirect your user to the http.
The redirect will only been done once, because your user will be on http for then on.
You can check if your user is on https or not with
Code:
Request.ServerVariables("HTTPS")
It will return on or off.
If it is and it shouldn't be, just redirect your user to the http.
The redirect will only been done once, because your user will be on http for then on.
Ah...so
Code:
pUrl=Request.ServerVariables("url")
if Request.ServerVariables("HTTPS")="on" and pUrl<>"/sslpage.asp" then
response.redirect("http://www.mysite.com"&pUrl)
end if
pUrl=request.servervariables("url")
pStrings=request.ServerVariables("QUERY_STRING")
if Request.ServerVariables("HTTPS")="on" and pUrl<>"/sslpage.asp" then
response.redirect "http://www.mysite.com"&pUrl&"?"&pStrings
end if
Make sure you have all the querystring variables.
you can also use request.servervariables("QUERY_STRING") to get the complete string following the question mark (?)
to do it the other way around when the "ssl required" box is checked in IIS you need to write a custom error page and set it up for your website/virtual directory.
Bookmarks