Subdomain Problem

Discussion in 'Classic ASP' started by itmanmike, Mar 30, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm trying to get a subdomain to redirt to a specific page name _
    ie: http://subdomain.domainname.com/folder/page.aspx. host says to use the following code but i'm not sure how to change some of the code and once i cahnge the code where do i put it?

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain1")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain2")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
    Response.Redirect("/subdomain3/home.asp")
    End If
    %>

    do i change all 3 lines? also what is the SERVER_NAME and do i change it?

    thank for any help.
    mike
     
  2. Mike,

    It all depends on how many subdomain names you are trying to cover. If you only have one subdomain name you will need to modify the code to read....

    <%
    InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then Response.Redirect("/subdomain1")
    %>
     
  3. <%
    InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then Response.Redirect("/subdomain1")
    %>

    i added the code to the website and it didn't work. does this code in the head or the body. we are using aspx, i added it to the default page. the default.aspx (for the subdomain) page i have sitting in a folder in the root directory. make any sense?
    thanks for any help.
     
  4. What do you mean by didnt work? Also, what did you replace the in the statement and where exactly is the file?
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page