redirects

What type of redirect is right for my website?

So you have decided that you need to redirect a page. Maybe this is to avoid duplicate content, a page has become obsolete or you just don’t like it any more.

What redirect options are there and which is best for you?

Last week I discussed possible reasons why one might want to implement redirects. This week I am going to discuss what type of redirect to use. I shall start with an overview of the various redirects available:

Meta refresh

A meta refresh is a meta tag which tells the user’s web browser to refresh the page after a set time has passed. When using a meta refresh as a redirect that time is generally set to 0 seconds. A meta refresh appears in the head of an HTML document and looks something like this:

 <meta http-equiv="refresh" content="0;url=http://www.manley-widgets.co.uk/medium-grade/alexander/"> 
 This page has moved, please <a href="http://www.manley-widgets.co.uk/medium-grade/alexander/">click here to visit the new page</a>. 

This example tells the browser to refresh after 0 seconds and to refresh to a new URL, in this instance http://www.manley-widgets.co.uk/medium-grade/alexander/.

HTTP refresh header

Essentially the same as a meta refresh, an HTTP refresh header is included in the response headers returned by the server and allows a time and a URI to be set, as so:

 HTTP/1.1 200 ok Refresh: 0; url=ttp://www.manley-widgets.co.uk/medium-grade/alexander/ Content-type: text/html 
 This page has moved, please <a href="http://www.manley-widgets.co.uk/medium-grade/alexander/">click here to visit the new page</a>. 

This example tells the browser to refresh after 0 seconds and to refresh to a new URL, in this instance http://www.manley-widgets.co.uk/medium-grade/alexander/.

JavaScript redirect

There are many ways to use JavaScript to redirect a page, but the most simple is window.location:

 <script type="text/javascript"> <!-- window.location = "http://www.manley-widgets.co.uk/medium-grade/alexander/" //--> </script> 
 <noscript>This page has moved, please <a href="http://www.manley-widgets.co.uk/medium-grade/alexander/">click here to visit the new page</a>.</noscript> 

JavaScript code can run in a run time environment (that is locally in a user’s browser, as opposed to server side processing) and therefore can have almost limitless triggers for redirecting.

Frames

Not strictly redirecting, a single frame displaying the target page can essentially deliver the new page to a user. The HTML might look something like this:

 <frameset rows="100%"> <frame src="http://www.manley-widgets.co.uk/medium-grade/alexander/"> </frameset> 
 <noframes> This page has moved, please <a href="http://www.manley-widgets.co.uk/medium-grade/alexander/">click here to visit the new page</a>. </noframes> 

The old URL will still be displayed if frames are used in this manner, even when the user navigates on from the target page, by default.

302 redirect

With a 302(found) redirect the requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests.

 HTTP/1.1 302 found Location: http://www.manley-widgets.co.uk/medium-grade/alexander/ Content-type: text/html 
 This page has moved, please <a href="http://www.manley-widgets.co.uk/medium-grade/alexander/">click here to visit the new page</a>. 

Basically, this means that the page has been found, but that the resource, or content of that page, is temporarily hosted elsewhere.

301 redirect

A 301(permanent) redirect is precisely that, permanent. A 301 indicates to visitors that they should update their URL data for that resource and tells them that it will not be at this URI again, but rather that it should be looked for at the target location.

 HTTP/1.1 30 Moved Permanently Location: http://www.manley-widgets.co.uk/medium-grade/alexander/ 

A page which has been 301 redirected is now obsolete and the new page is to be considered the resource.


So those are the main redirects used. There are others such as 307(temporary) redirects or a variety of other JavaScript and Flash redirects, but these are the 6 most common redirect types used.

I intended to move on to discussing their relevant merits and pitfalls, but I think that this post is long enough to be going on with, so I shall cover that next time.

Cheers,

Manley

Tags:

1 comments Add This

Redirects and you.

I have long intended to publish a series of informative tutorial style posts. Sort of beginners guides to the technical aspects of SEO, if you will.

The single largest avoidable problem I see has to be misuse of redirects, so I thought I would start there. It is a huge subject, so I am going to work through it in bite-sized chunks, starting with an exploration of why there is a need to redirect in the first place.

Why should I redirect pages?

Whilst Google can quite happily follow a permanent redirect and attribute link juice accordingly, not all search engines are as clever as Google, including others in the big four, so wherever possible the answer should be:

Don’t

A URI is supposed to be permanent and if one changes it is impossible to say who will have referenced the old URI. Whether this is a bookmarked page, an honest to goodness link or just a post-it note on the side of their monitor, anyone who follows a broken link is going to be irritated by it. Quite aside from not being able to find content or losing link juice, this is not good for your brand.

The majority of redirecting is unnecessary and downright inconvenient for users, webmasters and search engine robots alike. Yes, there will be situations where pages need redirecting, but the truth is that this is generally a mark of a failure to properly plan the site architecture. Redirects are a work around, not a solution, so please try and make sure that you consider the new structure carefully before implementing it.

There are exceptions to this rule. Whilst URIs should be permanent, best practice dictates that, particularly from a search perspective, pages (and indeed content) should only exist on one canonical URI. So let us imagine that I have a small to medium sized manufacturing company. Manley Widgets PLC sells a variety of products, ranging from the small attractive home use ‘Richard’, right through to the industrial grade ‘Magnus’.

All these products are aimed at a UK market and the medium grade ‘Alexander’ widget can be found at www.manley-widgets.co.uk/medium-grade/alexander/. I might well want a variety of other URLs which show the same page, for example:

As well as these branding issues, there are a variety of other URLs which might point at the same page, simply because of the way that the server is configured, for example:

Each of these variations is available for each domain and sub-domain as well, so we have already racked up 42 URLs which point to the same page on the server. On top of all of these, if you are using an IIS server, the URLs are case insensitive, so there is enormous scope for variety:

And so on. Any of these URLs can be indexed, either through mistyping or malicious link-building, and the duplicate content issues and the sharing of link juice can damage SERPs. Google handles canonicalisation issues very well, but no algorithm is perfect and poor performance in other engines (particularly the social-centric Yahoo!) can result in a depletion of links which will be reflected in Manley Widgets’ Google SERPs as well.

Obviously, 42 separate pages are unmanageable and we do not want to spread the link love across so many pages, so clearly there is a case for some redirects here,

Another scenario might be an obsolete page. Good content should be kept whenever possible, so that even if the ‘Alexander’ widget is discontinued, the page describing the widget’s features and listing part numbers could still bring in traffic. A page which simply sells the product might not be as useful any more, so it may be worth redirecting users who are coming into that page on to the new ‘Alexandra’ widget’s page.

Whatever your reasons, you are going to end up needing to redirect some pages at some point, so next time we will look at possible methods of redirecting, how they work, how search engines view them and which are best suited to your needs.

By way of closing words of wisdom, remember that a visitor (be they human or robot) to any URL which has ever been valid, should end up on a page on your site. Preferably this should be a page on the same subject or the next best option. It might be a page explaining why the page has gone and offering alternatives or, as a last resort, it might be the home page. Wherever the user ends up, they must have navigation available to them when they get there.

[UPDATE: The follow-up post on types of redirect is now available.]

Tags:

0 comments Share