While much of what goes on in the SEO world these days can be done without much technical knowledge a 301 redirect, unfortunately, is not one of them. Still, you’re in good hands, because I try to make most of the information I put here as accessible as possible on the basis that even expert webmasters can go wrong at the end of a 12-hour day spent online with their brains almost turning to mash from all the work they have had to do.
So let’s simplify things by working from the ground up. First, what’s a redirect: A redirect is a means of directing a specific URL to another one automatically without having to go to the first one, first. A website may be redirected for several reasons:
- A web site might need to change its domain name.
- An author might move his or her pages to a new domain.
- Two web sites might merge.
- With URL redirects, incoming links to an outdated URL can be sent to the correct location. These links might be from other sites that have not realized that there is a change or from bookmarks/favorites that users have saved in their browsers.
It may also be redirected for the old favorite: in order to tell Google (this is the only search engine where a redirect really matters) that the two versions of a website (the www. one and the http:// without the www in front) are actually the same website, thus avoiding duplicate content penalties and preserving PageRank (PR).
You may want to redirect a page to another page but redirects, predominantly, are from one URL to another. The only real search engine friendly way to do a redirect is to create a permanent one which on the web goes by the code name 301.
So far, so good. You know what a permanent redirect is and you know why you should do it but you do not yet know how.
Well, here goes:
There are several ways to setup a 301 redirect, below I will cover the most common ones:
The Canonical 301 Redirect will add (or remove) the www. prefixes to all the pages inside your domain. The code below redirects the visitors of the http://domain.com version to http://www.domain.com.
In order to use this method you will need to create a file named .htaccess (not supported by Windows-based hosting) and place it on the root directory of your website, then just add the code below to the file. The net results of implementing such a redirect is that your website will have a higher SEO score, a higher PageRank (PR) and better, overall, search rankings on the organic search results pages (SERPs) not just on Google but every major search engine.