301 Redirect

301 Redirect and SEO

Posted on

It hurts me to see how many people nowadays are losing their SEO link value by not implementing properly a 301 redirect.

What is a 301 redirect?

A 301 redirect will be sending visitors and (when it comes to SEO ranking) search engines to a different location (URL) that they originally requested.

From an SEO point of view using 301 redirect is the best action in order to keep the SEO value a page has gained over the years.

Why do people make mistakes?

Companies redesign their website or (the case I see a lot more often nowadays) move to another system (WordPress to Drupal, Drupal to Joomla…etc) and because everything looks like it’s working perfectly they assume that their SEO acquired ranking is still in place.

Wrong.

Google (and for that matter other search engines) only link ranking value with specific URLs. In the eyes of Google your old: www.mycompany.com/aboutus.php is not the same as www.mycompany.com/assets/aboutus.php or www.mycompanynewdomain.com/aboutus.php.

Those are three different pages and Google will disregard all SEO value from your original page. It will treat your ‘newborn pages’ as basically new and will assign them with a little or no SEO value at all.

The strangest thing here is that even experienced web developers and SEO professionals do not see or understand the reason so many websites are suffering an SEO decline after revamp or moving to a new domain.

How to solve this rather latent issue?

Simple. Or in the words of David Amerland:

Help your SEO with a 301 redirect (http://goo.gl/llU5QB).

Here is what we want to achieve:

User clicks on www.mycompany.com/aboutus.php.

User goes flawlessly to www.mycompanynewdomain.com/aboutus.php

The user doesn’t even realise that he was redirected to a different URL.

The way you implement your 301 redirect will depend of your exact situation, but my advice would be to allow somebody technical to do it for you. Don’t get me wrong – it is not a difficult task – but just sometimes errors are indistinct and very difficult to track down.

Some of the more famous methods of 301 redirect would be:

ASP .NET Redirect

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.your-new-url.com");
}
</script>

PHP Redirect

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.your-new-url.com" );
?>

JSP (Java) Redirect

<%
response.setStatus(301);
response.setHeader( "Location", "http://www.your-new-url.com" );
response.setHeader( "Connection", "close" );
%>

Old to New domain using .htaccess file

Create a .htaccess file with the code below:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.your-new-url.com/$1 [R=301,L]

This code will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.

The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed).

Note: Please REPLACE http://www.your-new-url.com in the above code with your actual new domain name. This .htaccess method of redirection works only on Linux servers having the Apache Mod-Rewrite moduled enabled.

Redirect to www using .htaccess file

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.your-new-url.com/$1 [r=301,nc]

Again this .htaccess file should be placed in your root directory and as above replace the http://www.your-new-url.com with your actual domain name.

Is it gonna be the same for the search engines – smooth and unnoticed?

Well not exactly. it will take some time for a search engine to find the new page through your 301 Redirect and index it. The good news – it will take the SEO rank assigned to the original page and assign it to the new one. But only when it sees 301 redirect.

But what about the rel=canonical attribute? My agency told me to use rel=”canonical” for redirection.

Wrong.

Though it is very often used as a 301 redirection substitute rel=canonical is an entirely different animal. Many webmasters know it has something to do with SEO so they wrongly assume that it can be used as a 301 replacement. Well, apart of the fact that it is not physically sending the user to your new page its purpose is to solve duplicate content issues on your website.

There is a very good article by Google explaining all the usage of Use canonical URLs here: http://goo.gl/eaZb14. In this article I can see a good advice from Google: “The 301 status code means that a page has permanently moved to a new location.” Stick to Google thinking…. it does pays off in the long run.

So the wisdom from this whole article is that moving to a new domain (or moving pages within your current domain) should not waste the SEO value your links have gained over the years. It is search engines friendly and it will also stop your visitors from  experiencing the “Page not found” nightmare.

Articles:

Help your SEO with a 301 redirect, by David Amerland

Use canonical URLs, Google Help

301 Redirects – Wikipedia, Wikipedia