Click to See Complete Forum and Search --> : asp script that redirects to a unique folder based on the domain


fuzecx
08-31-2007, 01:15 PM
Hi guys!

I'm looking for an ASP script that redirects to a unique folder based on the domain that a user has entered into their browser:

www.domain1.com --> --> www.domain1.com/folder1/
-- ASP Script --
www.domain2.com --> --> www.domain2.com/folder2/


With my webhost I have assigned several CNAMEs pointing to my home testing server via dynamic dns. I have only one ip address and only one port.

Is it possible to create a script like this? and if so can someone give me a little bit of help?

Thankyou,




Wayne

fuzecx
09-01-2007, 05:06 PM
Ok heres what I came up with. I might turn the if else into a case for obvious reasons. What do you guys think? Anyways I could make this better?

<% @language=VBScript %>
<% option explicit %>
<%

Dim currentURL

currentURL = request.serverVariables("SERVER_NAME")

If currentURL = "home.domain1.com" Then
Response.Redirect "http://home.domain1.com/site1"
Else
If currentURL = "home.domain2.com" Then
Response.Redirect "http://home.domain2.com/site2"
End If
End If

%>