1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

index.asp to root domain

Discussion in 'C#' started by YSeo, May 4, 2009.

  1. #1
    Hey guys

    can you please provide me with the right code for making a 301 redirect from index.asp to root domain (/)

    for example:

    www. domain .com/index.asp

    to

    www . domain . com

    thanks!
     
    YSeo, May 4, 2009 IP
  2. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you may need to create a default page for example default.asp instead of using index.asp
    so you may able to redirect

    from

    www. domain .com/index.asp

    to

    www . domain . com

    put the following asp code to the top page of index.asp
    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location","http:// www . domain . com /"
    %>
     
    wacamoi, May 4, 2009 IP
  3. YSeo

    YSeo Peon

    Messages:
    533
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I am afraid It didn't work .
     
    YSeo, May 4, 2009 IP
  4. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    have you went to CP to setup [default.asp] as the first priority default page
    [index.asp] can be the second priority?

    302
    <%response.redirect "http:// www domain com"%>
     
    wacamoi, May 4, 2009 IP
  5. YSeo

    YSeo Peon

    Messages:
    533
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    that's what I have done:

    I made a copy of index.asp , and called him default.asp

    I took the original index.asp , and placed the first code you gave me.

    uploaded both to the server

    the result: index.asp is redirecting 301 to root domain name.

    question: there is still duplicate - www.domainname.com/default.asp and www.domainname.com

    what can I do ?

    Thank for you help sir.
     
    YSeo, May 4, 2009 IP
  6. YSeo

    YSeo Peon

    Messages:
    533
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    YSeo, May 4, 2009 IP
  7. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #7
    It is easy. Do not worry it. There is no duplication problem.
    You blank index.asp but only keep 301 header, because redirect is before all reading.
     
    wacamoi, May 4, 2009 IP
  8. YSeo

    YSeo Peon

    Messages:
    533
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    so it's all set and done now ? what I have done was okay?

    "You blank index.asp but only keep 301 header, because redirect is before all reading.
    "

    I am afraid I don't understand that part. would you please explain?

    thank you very much.
     
    YSeo, May 4, 2009 IP
  9. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #9
    YSeo you did well

    keep this header part on the top of index.asp

    <%
    Response.Status="301 Moved Permanently"
    Response.AddHeader "Location","http:// www . domain . com /"
    %>

    Yes, you did fine already, since the page been relocated to a new place by 301, therefore SEs only be able to crawl new page's body.

    Regards,
     
    wacamoi, May 4, 2009 IP