Tip
Subject Content

112
Redirect users to a secured site

When you use SSL to secure the communication between your Web servers and its clients, users

have to manually specify the https protocol instead of http. If users fail to specify https, the Web

server displays a default error message that some users might find confusing. The best way to

handle this is to make sure that the user never has to think about this error message.



Providing a default document that automatically forwards users to the secured site is one way to

ensure that users aren't confronted with the Web server's cryptic default error.



To forward users to a secure site, add this code to your default document:



<%

if (Request.Servervariables("SERVER_PORT") = 80) then

path = "https://"

path = path & Request.ServerVariables("SERVER_NAME")

path = path & Request.Servervariables("URL")

if (Request.Servervariables("QUERY_STRING") <> "") then

path = path & "?" & Request.Servervariables("QUERY_STRING")

end if

response.redirect path

end if

%>



Now when the user tries to access this document, the Web server will check to see if he or she is

using https. If the user did not use https, he or she will be immediately redirected to the SSL

secured site.

Page 112 of 237
First Previous Next Last