Working with redirects in an SEO friendly way - 301
July 11th, 2007 by Joost SchrierThe sad thing about making websites is that they are, by definition, temporary. At the speed the internet is moving, you just know that the website you made yesterday is not good enough anymore tomorrow. But then again, this is marketing and that’s the way it works. You need to move forward and renew yourself, and your company, every day to be able to stay ahead of the curve.
When you redesign, reorganize or rebuild a website the URLs of the individual pages will usually change as well. This becomes a problem when you think of all the links into your website and the link juice you’re throwing away if you don’t redirect these links in an SEO-friendly way. Sure, you can catch the errors people are getting and redirect them to the proper page or your homepage with links or JavaScript, but these methods don’t work well for the search engines. This is where 301 redirects come into play.
What is a 301 redirect?
A 301 redirect is an HTTP status code (see next paragraph) which tells a visitor’s browser, or a search engine, that the requested page has been moved permanently to another location. Then, without looking if the page is still at the original location, the browser is redirected to the new location.
HTTP status codes are, simply put, codes that servers use to inform your browser about the state of a requested page before it is actually sent to you. Well known codes are, of course, the error codes like 403 (Access Forbidden), 404 (Page Not Found) and 500 (Internal Server Error). The one you probably get most though is usually not seen, that’s code 200 (OK).
For more information about the different HTTP status codes you should check W3C’s page on status codes (which, incidentally, redirects you from w3c.org to w3.org). A useful tool to actually see status codes happening in your IE browser is HttpWatch (if somebody knows of a similar plugin for FireFox, please let us know).
Why use 301 redirects?
As I said above, you use a 301 redirect to tell browsers and search engines that a page has been moved to a different location. But why should you not use other redirection methods then?
A common way to handle people that wandered onto a moved page is to display a page telling them to update their bookmarks and presenting them with the correct link. This is a valid way of handling this for people (except for the fact that the visitor needs to click an extra time), but it doesn’t work well for search engines.
The reason is that the links to the original page have basically become useless. They transfer relevance to a page that is not relevant anymore. Besides this, the link juice goes to a page with no content instead of to the page you are trying to rank in the search engines. This means that it will take a long time to rank your new page in the search engines again and it will probably not reach the same status it once had.
Another method of redirecting users is to use a Meta Refresh tag (<META HTTP-EQUIV=’Refresh’ CONTENT=’[amount of seconds];URL=HTTP://[someurl]’>). This is a very old tag which gives visitors an amount of seconds on a page before redirecting them to the proper URL. You can also set the amount of seconds to zero.
This tag was actually meant to use for pages that you want to refresh every few seconds for information that was very time-sensitive. At a certain point is was used a lot by spammers though. They would stuff a page full of keyword-filled text to get it to rank in the search engines. The page would also contain one of these Meta Refresh tags with the amount of seconds set to zero. The search engine spiders would not be effected by the Meta tag and index the contents of the page. When a visitor went to the page from the search results, they were automatically redirected to another page/domain. It worked well for a while.
Right now, search engines don’t trust these Meta Refresh tags anymore and, if you use them, you are more likely to be seen as a spammer. Besides this, unsuspecting webmasters often use this tag for very functional reasons without stuffing the page with keywords (for instance: to get some old-fashioned statistics counter time to receive the visitor). The result: a page with hardly any content and certainly no relevant content. Usually all you see in the search results is the word “redirecting” (although chances are slim that you will actually see it in the search results).
There are of course more ways to redirect visitors from old pages to new pages, but these are the most common ones.
How to use 301 redirects?
We are not big fans of using Windows servers for websites, but if you must use Windows then you must. If you want to know how to implement redirects in IIS you can check out this resource at mcanerin.com (the first result in Yahoo). Here we will only discuss how to do this on Apache (and most other Linux webservers).
To do this, you will need to be able to edit the .htaccess file in your website. In your .htaccess file you add the following line to redirect one specific page to another page.
redirect 301 /yourpage.html http://www.example.com/newpage.html
The “redirect 301″ tells the server to give a 301 redirect HTTP status code when something asks for the page following it. The “/yourpage.html” tells the server which page the redirect applies to and the “http://www.example.com/newpage.html” tells it where to redirect the request to.
When you do this, you need to make sure that the second directive starts with a /. The reason for this is that you always relate the redirect from the root of your website. There is no such thing as a relative redirect.
The third directive always takes the full URL of the new page. The reason for this is that the new page could be within your own website, but it could also be on a different URL. As redirects are not relative, you need to add the full domain name and the http://.
You can also redirect all pages on your website to a different domain name by using this one:
RedirectMatch 301 ^(.*)$ http://www.example-new.com
The “RedirectMatch 301″ allows you to use regular expressions in the redirect. This is very useful when you want to move your entire website or an entire subdirectory to a different location.
One important thing to keep in mind is to test your redirects after you have implemented them. If you make mistakes with this, you could effectively kill your website. Google says that 301 redirects will be reflected in their index in 6 to 8 weeks but if your website is indexed frequently it will definitely go faster.









