Yet another 301 redirect question :)

Discussion in 'General troubleshooting' started by 74hundo, Jul 28, 2010.

  1. I've looked at all the threads on this and being a newb i'm a little unclear so am hoping someone can clear up some questions i have. I have a site, www.abc.com. I would like the entire site 301 redirected to www.xyz.com.

    One snippet suggested:
    Code:
    At the top of default page: (above <html> tag)
    
    <%@ Language=VBScript %>
    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location","http://www.xyz.com/"
    %> 
    Being that this is only on the default page, what if a user comes in via a bookmark or link on a specific page. Would this code still work?

    Or do i have to add a snippet like that to every page on my site?

    Alternatively, i saw this in the support KB (hopefully i adapted correctly..):
    http://support.discountasp.net/KB/a...main-to-a-subdirectory.aspx?KBSearchID=183884

    Code:
    <%
    If InStr( UCase(Request.ServerVariables("SERVER_NAME")),  UCase("www.abc.com") ) > 0 Then
            Response.Redirect("www.xyz.com")
    End If
    %>
    Does it matter which I use? Either snippet would just appear above the html tag in the default.asp(x) page?

    Thanks for the help!
     
  2. i should add that our hosting is not on IIS7 either.
    thanks!
     

Share This Page