Forums
This topic is locked
writing a script for redirection
Posted 17 Mar 2003 23:11:47
1
has voted
17 Mar 2003 23:11:47 Kristian Waagsboe posted:
I have to DNS services pointing to my IP adress, and I want the two of them to enter two different folders in my wwwroot. This means that the script will have to analyze what the user has written in the adress bar... Is this possible? Or is there other ways for me to do it?.:. DWMX .:. MS IIS 5.1 .:. WinXP .:. MySQL
Replies
Replied 22 Mar 2003 22:02:50
22 Mar 2003 22:02:50 Marcellino Bommezijn replied:
Try to use the script below. Add this at least to your Default.asp pages and preferably to all pages. This script let's you redirect to a directory based on the input of the URL in the address bar.
Response.Buffer = True
Dim Host
dim Hosturl
dim ServerDir
Host = lcase (request.servervariables("SERVER_NAME"
)
Hosturl = mid (Host,5,99)
serverDir = "" & Hosturl
If Hosturl = "yourdomain1.com" Then
serverDir="/dirdomain1"
response.redirect serverDir
ElseIf Hosturl = "yourdomain2.com" Then
serverDir="/dirdomain2"
response.redirect serverDir
End If
Response.Buffer = True
Dim Host
dim Hosturl
dim ServerDir
Host = lcase (request.servervariables("SERVER_NAME"

Hosturl = mid (Host,5,99)
serverDir = "" & Hosturl
If Hosturl = "yourdomain1.com" Then
serverDir="/dirdomain1"
response.redirect serverDir
ElseIf Hosturl = "yourdomain2.com" Then
serverDir="/dirdomain2"
response.redirect serverDir
End If