What Is a 301 Redirect?
301 redirects are a way of ensuring online traffic gets sent to the most up-to-date version of a URL. For example, if you delete a page on a website and your customers try to access that page and it’s no longer there, they get an error message, which isn’t a great user experience, right? So, what you do is permanently redirect the old URL to the new, or most appropriate URL (known as a 301 redirect).
For example, if we wanted to redirect www.example.com/old to www.example.com/new, we would need to implement a 301 redirect from the old URL to the new one. Once this redirect has been implemented (which I will go on to explain), someone typing in www.example.com/old would land on www.example.com/new via the 301 redirect.
What Does “301” Redirect Mean?
The “301” status code is one of many HTTP responses, that tell us and search engines what is happening with that URL. The HTTP response status code “301” means this URL has moved permanently and as such, should only be used for permanent redirection, meaning any links featuring the URL that the 301 moved permanently response is received for, should be redirected to the new URL provided.
To better explain this, it is worth briefly running through the process of a how a web page is presented (or served) to a user in the first place. Whenever your website server “serves” up a web page on your site to a visitor (either a human or search engine spider) it also serves a status code in the header. This information is “served” before the actual page content to inform your browser (or search engine) what the page (or file) contains, be it an image, HTML, PDF, video etc. The server status code is designed to inform the visitor or search engine the “status” of the page (file) in question.
You can check this yourself using a handy HTTP status checker that I use all the time for a quick visualisation of what’s going on.
To provide a real-life example of this, we can have a look at what information our server sends out when it receives a request for our home page:
The line I have highlighted in yellow above (HTTP/1.1 200 OK) is the status code I was referring to. A status code of 200 OK essentially means that the web page requested is available and will be sent in response.
If a 301 redirect was used to redirect one page to another, the server would serve a status code of: 301 Moved Permanently. In addition to the original page requested, this header response will return the URL of the new page location. Below I have provided an example of the status code presented whenever someone requests our HTTP version of our site (now https://www.hallam.co.uk):
This information is essential if you’re moving content from one location to another, not least for search engines. If a search engine spider encounters a 301 redirect when crawling your website, it indicates to them the need to remove the old URL from their index, and replace it with the new one instead. This means that the new page should eventually replace the old page in the search engines index – and in the meantime, the old URL will redirect human visitors to the new URL whenever anyone attempts to access it.
If you don’t use a 301 redirect whenever you remove a page from your web server, search engines will be served a 404 Not Found error response code, which will result in the page in question being dropped from the search engine’s index completely over time.
When Should You Use 301 Redirects?
Indeed, the examples I have provided so far centre around moving a page from one URL on your site to another. However, 301 redirects can be used in a multitude of other scenarios, including:
- Moving to a new domain (our previous website was Hallam.biz which is now redirected to Hallaminternet.com)
- Cleaning up dynamic URLs and redirecting them to shorter search engine friendly versions
- Preventing duplicate content problems; for example, if you have multiple blogs written on the same subject and want to aggregate them into one blog
What Is the Difference Between a 301 Redirect and the Rel=”Canonical” Attribute?
To clear up some confusion, I’d like to address the difference between a 301 redirect and the rel=”canonical” attribute. The rel=”canonical” attribute is often misused as a 301 substitute.
- A 301 is a permanent redirect that physically sends the user to the new page
- Show new “Page B” to all trying to access old “Page A”
- The rel=”canonical” attribute is an indication or a suggestion for the search engine as to which version of a group of similar pages is preferred, to avoid duplication of content
- Show “Page A listing products by price” instead of “Page B listing products alphabetically”
Therefore, the canonical tag should be used on pages which show near identical content to others (dynamic pages with multiple URLs of the same page as in the above example, domain Vs domain/index.html etc). Whereas 301s should be used on pages or domains that are being moved or replaced.
SEO Benefit of 301 Redirects
It is important to remember that changing even the smallest aspect of a page’s URL structure could cause said page to drop out of the search results entirely, which is why a 301 redirect is essential in maintaining the traffic/rankings that page may have been generating prior to the change in its URL structure.
Note: It’s worth noting here that any differences in URLs are seen by search engines as separate pages e.g. all of the below are different variations of the same page.
For example, if you’re planning on developing a new website in the future, then it’s worth bearing in mind that new websites often mean new or different URL structures – maybe you’re moving to HTTPS (finally) or getting rid of a category or two? If over the years you’ve been producing some epic, engaging and relevant content, it is highly likely that these pages will have generated inbound links. Therefore, you need to ensure you transfer this authority across to your new URLs.
Note: It might be reassuring at this point to reiterate the words of Google’s head of webspam (Matt Cutts), who states that “301 redirects can carry an identical amount of pagerank as that passed on by a link“.
Problems With 301 Redirects
One major problem that I come across on a regular basis is that over time, 301 redirects become an ungodly mess (picture a Jackson Pollock painting). This kind of thing doesn’t do my OCD any good. The main reason for this is that redirects get placed on top of redirects. For example:
- Page A is old….redirect to shiny new Page B!
- Page B is old…redirect to shiny new Page C!
- Page C is old…redirect to shiny new Page D!
- Page D…you get it.
These are called redirect chains and they are bad because too many redirects stop links or page authority being passed on to the most relevant page. Essentially these need flattening out so that each old variant of a page redirects straight to the new one. For example:
- Page A > Page D
- Page B > Page D
- Page C > Page D
Another common issue I see with 301 redirects is that they are used incorrectly. The most common manifestation of this is a website owner redirecting all old pages to the homepage (because it’s quicker). If you’re slimming down the content of your website, creating new pages or categories, you need to spend time making sure that each old page is being redirected to the most relevant new or existing page. Think about user experience and whether you’d be cheesed off if you wanted to find that epic page about redirects, only to be redirected to the homepage!
A final issue I will mention is not in the implementation of the redirects, but access. Sometimes it’s hard to get access to set up redirects because your developer tells you that you already have too many or maybe you just don’t have access to the server side. Thankfully, there are plugins that help you to manage redirects, such as Redirection as mentioned above, which can help with access. Alternatively, I will explain how to set up a .htaccess file.
How to Set up 301 Redirects
Now that I’ve explained what 301 redirects are, their importance, and the instances in which you should be using them, I will now go on to explain the most common way of implementing them for pages on your website.
In the vast majority of cases, a web server’s behaviour is configured using what’s called a .htaccess file. This is a simple text file that sits in the root directory of your site (where your homepage also sits). For the purpose of implementing a 301 redirect, you will need to place a .htaccess file in your root directory (if one doesn’t already exist). You can create/edit a .htaccess file using any plain-text editing tools like Notepad or Textedit – before naming the file you have created/edited ‘.htaccess’.
To explain the text that should be contained within your .htaccess file, I will start by using a very basic example such as renaming a page on your website. For example, if you wanted to change a page’s URL from:
To ensure the old page redirects to the new page, you would need to add the following code to your .htaccess file:
redirect 301 /old.html http://www.example.com/new.html
Here’s an explanation of what the code above means:
- “redirect 301” tells search engines (and browsers) that your page has been moved permanently
- “/old.html” – provides the old location of the page
- “http://www.example.com/new.html” – is the new location of the page you’re telling the server to redirect visitors to. This part of the code requires the complete URL to work properly
It is important to note that if you are moving multiple pages, you will need to include a redirect statement for every page you’re moving. Having a unique line for each page is what I would suggest to be the safest approach, if you want to ensure that your commands are picked up by search engines.
There are very useful plugins you can use which take the coding element away from creating a 301 redirect file; for example, if you work with a CMS like WordPress, a tool such as Redirection can help. However, if you have access to the .htaccess file you could also use 301 redirect generators such as this one.
At this point, you should be able to understand:
- What a 301 redirect is
- Why you would use it
- The basics involved in implementing 301 redirects
By using 301 redirects, you are essentially providing the search engines with a note to say “this page has moved, please find the latest version here”, the importance of which cannot be overstated.
As always, I’m happy to answer any questions you may have in the comments section, so please feel free to start the discussion below.
301 Redirect Tools
Below is a list of the 301 redirect tools I referenced in this blog:
If you’d like some help with your SEO, then get in touch with our experts.