programming-examples/asp/Miscellaneous/Domain Redirect.asp
2019-11-18 14:25:58 +01:00

31 lines
910 B
Plaintext

'Set up the redirect variables
Dim strURL 'This is the URL the user typed into the browser
Dim strSiteName 'This is the domain name
Dim intEPos 'This is the position of the remaining dot
strURL = Request.ServerVariables("HTTP_HOST")
intURLLen = Len(strURL)
If InStr(1, UCase(strURL), "WWW") > 0 Then
strURL = Right(strURL, (intURLLen - 4))
End If
intEPos = InStr(1, strURL, ".")
strSiteName = UCase(Mid(strURL, 1, (intEPos - 1)))
'Insert your site names in the Select Ca
' se statement below to
'replace the Your-Site, Your-Next-Site &
' Default-Site text.
'Feel free to add to the select case for
' additional sites.
Select Case strSiteName
Case "Your-Site"
Response.Redirect "http://www.Your-Site.com"
Case "Your-Next-Site"
Response.Redirect "http://www.Your-Next-Site.com/sitedir"
Case Else
Response.Redirect "http://www.Default-Site.com/home.html"
End Select
%>