Having problem with the Domain redirect script

Discussion in 'DNS/Domain names' started by MDunn, Feb 2, 2010.

  1. Hi, I'm having trouble with the script for redirecting a subdomain. The knowledge base info and suggested example is very vague. Has anyone set this up using the suggested script or what other successful method works? My primary site is Btech1.com and I want to redirect my second domain Xgifts.com to my Xgifts folder residing in the root directory of Btech1.com. Winhost support suggested I use the suggested script but like I said it's not very helpful. I've tried it in a combination of ways but keep getting syntax errors. In the knowledgebase, it states I should put the script in the root section of the default document. There really should be an visual example of the complete header section of a document that includes the suggest script. below is the suggested script.
    Help!! :eek: Thanks.:)

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

    Ray

    Placing the script typically goes on the top portion of the default page such as default.aspx. The script should look something like this...

    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")),
    UCase("www.xgifts.com") ) > 0 Then
    Response.Redirect("/xgifts")

    ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")),
    UCase("xgifts.com") ) > 0 Then
    Response.Redirect("/xgifts")
    End If
    %>

    Don't forget that IIS 7 also has a URL Rewrite module. This can also be used to do some redirect. It can be a little complicate cause it uses all these expressions that you normally find with Perl programming. You may want to look at this link to learn more about URL Rewrite in IIS 7.
    http://www.cto20.com/post/Tips-Tricks-3-URL-Rewriting-Rules-Everyone-Should-Use.aspx

    If you want to connect to our server using IIS 7 Manager, try looking at this kb article.

    http://support.Winhost.com/KB/a628/using-the-microsoft-iis-70-manager.aspx
     
    Last edited by a moderator: Oct 14, 2015
  3. Thanks! I'll try the IIS 7. I need to learn to use it better anyhow.
     

Share This Page