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
Written by Ben Strackany -- January 8, 2005
Ben worked for a variety of tech startups in Chicago before moving to Portland and starting DevelopmentNow in 2005. When he's not herding cats, stirring pots, and taking names, he enjoys drinking coffee while irritating the studio audience with bad puns.