Forum Moderators: open

Message Too Old, No Replies

How To 301 Redirect https pages to http?

We use IIS 6 without ISAPI Rewrite capability

         

jastra

3:03 pm on Aug 14, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



We have some https ASP pages living in a couple of subfolders. We want to 301 redirect them to the http versions. How do we do that without using ISAPI rewrite?

marcel

5:01 pm on Aug 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Jastra, you can check to see if the request is secure by checking Request.ServerVariables("HTTPS"), eg.


<%
if Request.ServerVariables("HTTPS") = "on" then
server = Request.ServerVariables("SERVER_NAME")
script = Request.ServerVariables("SCRIPT_NAME")

Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://" & server & script
end if

' Otherwise, continue with normal page operation
%>