Saturday, January 08, 2005

310 Redirect for Search Engines and Changed URLs

 
Say you have some pages indexed in search engines, but you want to change the URL of those pages. What you should not do:
  • Do NOT delete the old pages and create new ones at the new URLs -- this will cause all your links to drop from search engines.

  • Do NOT keep the old pages around and create new ones at the new URLs -- search engines will penalize you for having duplicate content. They could ignore the new URLs, or drop your site entirely

  • Do NOT redirect the old pages to the new URLs via javascript or META Refresh -- search engines will think you're trying to do something tricky

  • Do NOT redirect the old pages to the new URLs via Response.Redirect (i.e. HTTP 302 redirect) -- this is by definition a "temporary redirect" and could confuse search engines or again make them drop your links


  • What you want to do is 1) automatically jump users to the new URLs when they visit the old URLs, and 2) tell search engines that your pages are still good, but they just have a new URLs. You accomplish this with a HTTP 301 Redirect : Moved Permanently". And the code is simple...put this code in your old URLs.

    ASP:
    Response.Status = "301 Moved Permanently"
    Response.AddHeader "Location", "http://www.domain.com/newurl.asp"


    ASP.NET:
    Response.Status = "301 Moved Permanently";
    Response.AddHeader("Location", "http://www.domain.com/newurl.asp");


    Linux/Unix Apache, in your .htaccess file, put
    redirect 301 /oldurl.html http://www.domain.com/newurl.html





    view current posts

    Comments:
    Thank you so much for your suggestion, which is exactly what I have been looking for. Could you please elaborate more?
    I have a site www.orientalpearls.net, I used to use static page, even though it shows as asp. Then my contracted web developer put them into a php database, it's easier for me now, but the problem is people still find me from my asp page. So could you please tell me what I should do in more detail? copy your code for ASP or create .htaccess file. (do I have to create the file for each page? i.e. www.orientalpearls.net/pearl_earrings.asp)Thank you very much! Also my email is lan@orientalpearls.net. I appreciate very much for your help since I am not that sophiscated in this.
     
    Hi -

    You need to put the 301 redirect code into the OLD pages, and have it point to the NEW pages.

    For example, assume your OLD page is

    www.orientalpearls.net/pearl_earrings.asp

    and your NEW page is

    http://www.orientalpearls.net/pearl_earrings.php.

    Then at the top of pearl_earrings.asp, put the ASP 301 redirect code like this

    Response.Status = "301 Moved Permanently"
    Response.AddHeader "Location", "http://www.orientalpearls.net/pearl_earrings.php"

    You will need to have the 301 redirect code in all of your ASP pages. If all your new pages are the same file as the new pages, but with PHP extensions, you might be able to do something fancy like

    Response.Status = "301 Moved Permanently"
    Response.AddHeader "Location", "http://www.orientalpearls.net" & Replace(Request.ServerVariables("PATH_INFO"),".asp",".php")

    inside all your ASP files (or inside an include file that they all use).

    Let me know how that works out!

    Ben
     
    Post a Comment

    Archives
    September 2004   October 2004   November 2004   December 2004   January 2005   February 2005   March 2005   April 2005  

    This page is powered by Blogger. Isn't yours?