Subdomain URL

Discussion in 'Windows / IIS' started by msc, Jun 4, 2009.

  1. msc

    msc

    I have two domain names pointed at my site.
    domain1.com the original domain
    domain2.com the new domain

    When someone gets to the site using www.domain2.com, I know how to redirect to a folder in my site but I want the url in the browser to show the domain2.com not domain1.com

    Is there a way to do this?
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    The following code should work fine.

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("DOMAIN1.COM") ) > 0 Then
    Response.Redirect("/dir1")
    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("DOMAIN2.COM") ) > 0 Then
    Response.Redirect("/dir2")
    End If
    %>
     

Share This Page