Web page redirect

Discussion in 'Visual Studio' started by Warn, Mar 3, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Lost as a goose. I am a visual learner but dont seem to be getting it.
    Have two sites.
    www.mainwebsite.com
    www.2ndwebsite.com

    I have yet to get the 2ndwebsite to point to it's folder and not open the main.


    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.www.mainwebsite.com") ) > 0 Then
    Response.Redirect("/subdomain1")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.www.2ndwebsite.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





    And when I get this correct it will go in the Doc folder?
     
  2. For classic ASP I'd do it like this:


     
  3. Thanks Mark maybe I am starting to understand/learn a little more. Do I remove the Elself for subdomain3 and go with what I have below?

    <%
    ' Testing lines shown below return 6 types of info:
    'Response.Write(Request.ServerVariables("URL") &amp; "")
    'Response.Write(Request.ServerVariables("ALL_HTTP") &amp; "")
    'Response.Write(Request.ServerVariables("LOCAL_ADDR") &amp; "")
    'Response.Write(Request.ServerVariables("REMOTE_ADDR") &amp; "")
    'Response.Write(Request.ServerVariables("REMOTE_HOST" &amp; ""))
    'Response.Write(Request.ServerVariables("SERVER_NAME") &amp; "")
    '
    Dim Caught
    Caught = Request.ServerVariables("SERVER_NAME")
    If Caught = "subdomain1.www.warrenrainey.com" Then
    Response.Redirect("http://www.warrenrainey.com/subdomain1/")
    ElseIf Caught = "subdomain2.www.tennesseevalleyarc.com" Then
    Response.Redirect("http://www.tennesseevalleyarc.com/subdomain2/")
    ElseIf Caught = "subdomain3.YourHostedDomainName.com" Then
    Response.Redirect("http://YourHostedDomainName.com/subdomain3/home.asp")
    Else
    Response.Redirect("http://www.warrenrainey.com/subdomain1/")
    End If
    %>
     
  4. Did you know I'm in Johnson City TN? [​IMG]

    As for the ASP code, ElseIf is like counting on your fingers, one finger to the next while it checks.
    The last Else check is in case it makes it that far, a last resort.
    Salute,
    Mark
     
  5. Naw sure didnt. Dont email me your cell or work numbers as I will worry the pee out of you till I learn this.


    [email protected]





    Thanks for your help.
     
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