February 19th, 2008

Re-directing web pages for SEO – 301 Moved Permanently

Moving your web site – the risk of losing traffic

Moving content from one address to another can be a tricky business, whether you’re changing domain or just re-organising your content. You want to make sure that the change does not impact on your hard-earned back-links and ensure that anybody landing on your site through a link is routed to the correct new location.

If a link directs a user to a page that no longer exists then you’ll most likely lose them – they’ll get a “page not found” error and move straight on to another site. Just as important is how a search engine spider interprets your move – if it follows a link to your site and can’t find the content then it will discount the link.

If you move or re-organise your site without re-directing your content consistently and correctly, you won’t only lose traffic, you’ll also lose your link credibility in Google and see your site slide down the page rankings.

The solution – 301 redirect

A web server sends a response code to a browser when it tries to access a web page. Normally, it sends a “200 OK” message, meaning that it’s found the content without any problems. If it can’t find the content it will normally return a “404 Not Found” code, which is normally interpretted as an error.

If you want to re-direct an old address to a new address then you have to ensure that your web server explicityly re-directs the browser to the new address and tells the browser that the content has moved. This involves returning a “301 Moved Permanently” status code to the browser. If you do this correctly then visitors will be passed on cleanly and search engines will transfer any value of the page to your new location.

A commonly made mistake here is that people re-direct content without sending the right status code. Commonly-used code re-direction techniques, such as .NET’s Response.Redirect() method, send the wrong status code to the browser – in this case, a “302 Moved” code is sent. A user will still see the right content, but search engines will not carry over any SEO value to the new location.

The techniques for performing a 301 redirect vary depending on your web server and development language. A pretty good survey of the techniques lives here. Personally, I prefer to use URL-rewriting to establish a consistent system when I’m moving content as it allows you to keep all your renaming logic in a single place rather than scattering it around a number of redundant web pages.