DDMSEO - Full Stack Developer based in London

Optimize your website SEO with X-RAY SEO Auditor

Published: 20th Dec 2017 | Words: 1,284 | Reading Time: 7 minutes

Categories / Tags:

SEO

301 redirects and SEO

If you have a website online for a long period of time you will inevitably run into the problem of having highly ranked pages which you may wish to remove and replace with another page. The URL of these pages could change and you can find yourself in a situation where you can’t afford to lose the rank that you have spent so long building up on these pages. 301 redirects solve the problem of losing any rank these pages may have if you wish to get rid of them. In a nutshell 301 redirects tell search engines a page has moved and sending a 301 header to search engines points them to where the page has moved.

Using 301 redirects

301 redirects should be used only when they are really needed. Using them on every single page you get rid of is usually very bad practice. When you redirect a page it should redirect to a page that is very similar and should never redirect to something that is completely different. A highly ranked page will usually be ranked for something specific and specific keywords and if you are removing this page you should be redirecting to something which is also very specific to the same topic. On this website here if I was to get rid of the page on SEO I would not redirect to the web development page as although they are web related they are completely different topics.

Avoid blanket 301 redirects

On many websites you will see systems in place where any page that is removed from a website it will automatically redirect to the homepage. Again this is not a great solution to put in place and completely defies the idea of redirecting to a page that is very similar. Building your website the right way from the very start can avoid the use of 301 redirects almost completely but for many websites that have a poor URL structure from the beginning this isn’t an option. The problem with 301 redirects is that you can go completely overboard with them very easily. Websites can bloat in size very quickly especially when they are dynamically generated and can go from a few dozen pages to thousands if there is a lot of work done on them.

Passing pagerank with 301 redirects

A lot of the thought process when using 301 redirects comes down to page rank. Although page rank doesn’t update much anymore highly ranked pages are still highly ranked pages and when you remove them you should try to point them to another page similar in nature to pass the rank onto these pages. You can make pages rank very quickly in search results if you point to them with 301 redirects especially if the page you are getting rid of is an integral part of your website. There are many situations where you may wish to remove a webpage and replace it with a better one, for instance if you have a crazy URL that is very long or un-necessarily complicated. In this situation you may wish to replace it with ne that is shorter and easier to remember one and therefore a 301 would be perfect to get rid of this page and replace it with the exact same one just underneath a new URL. Not all the rank will pass to the new page but the loss is the scheme of things should be miniscule.

Pages you should 301 redirect

It’s quite easy to figure out what you should redirect with 301’s. When you remove pages form a website you should always have a rule to 404 first. I don’t mean you should 404 every single page and just leave it like that but rather you should think to 404 pages unless they have value instead of thinking of using 301 and then picking some pages to 404. Google Webmaster Tools has a crawl errors report which shows you all pages that are returning various codes like 301, 404, 500 etc. and if you regularly check this report you can find out which pages to 301 almost instantly. Within this report you will see a list of URL’s grouped by their returned status codes and if you click on any of the URL’s you can see where they are linked from. If you 404 pages they will appear here and you can go through each of the URL’s here extremely fast, check the websites they are linked from and set up 301 redirects on important URL’s. Using a method like this means the page you wish to redirect will return a 404 status code until you redirect it but if you redirect it with a 301 as soon as it shows the impact to you is nothing. Again you should redirect to pages which are similar in nature. You should have a detailed look at the pages and ask yourself, are they relevant to you, have they high page rank and do they generate traffic. Usually a high PageRank from the page is all you need to say to yourself you need a 301 redirect but pages without high page rank can also have value to you. Any page that generates a lot of traffic to your site should be re directed.

Testing 301 redirects

There is no end of tools online that lets you test the status codes returned when you request a webpage and you can test your own pages using things like curl in PHP. Always test any redirects you put in place. It can be quite easy to make a mistake when configuring 301 redirects.

Building 301 redirects with htaccess

Building 301 redirects in your htaccess is probably the easiest way to implanting redirects. You can do all sorts beyond the scope of this article like redirect multiple pages, redirect to other domains and many other things. The only issue with 301 redirects in an htaccess file is if you have a massive website your htacccess file can end up huge. You can go down the PHP route and build them with PHP or even build an entire redirect system using PHP. But how you choose to implement them should be custom to your websites particular needs. If you have only a handful of 301 redirects they are probably better off in an htaccess file and there would be no need for a massively complex custom system or class.

Redirect 301 /old-seo-page.html https://ddmseo.com/new-seo-page

Building 301 redirects with PHP

PHP provides an easy way of implementing 301 redirects. The only thing to watch out for is that they must be sent before any output to the browser that means no HTML or even whitespace should be sent otherwise they will fail. This is one of the reasons you should always test your redirects. You may think you have them set up properly but sometimes you may have other parts of your code that can make them fail.

header("HTTP/1.1 301 Moved Permanently"); 
header("Location: https://ddmseo.com/new-seo-page"); 

header("Location: https://ddmseo.com/new-seo-page", true, 301); // shorthand way of doing it
Rate this article

Average: 0.00 out of 5 / Votes: 0

Comments

Please login or register to post comments

Login | Register