A Comprehensive SEO Guide to 301 Redirects: When and How to Use Them

Melissa Fach

May 08, 202019 min read
301 Redirect Guide for

Understanding 301 redirects as an SEO is essential. While they might seem simple at first, understanding how they should (and shouldn’t) be used in different scenarios is a little more complex, albeit one you should be able to master pretty quickly. 

You might need to redirect a page for a number of reasons such as: 

  • You have found a broken URL.

  • Your page has moved to a new location.

  • You are changing your domain name.

  • You need to delete a page.

If you don't know how to properly use redirects, you could quickly cause problems that negatively affect both your SEO and user experience. 

This guide is here to help you to learn everything there is to know about 301 redirects and how they fit into your SEO strategy, and we will cover:

What is a 301 redirect?

Web pages get removed, and URLs get changed for many reasons, from discontinued products being deleted to URLs that include dates being updated. 

This is totally normal and often cannot be avoided (although deleting discontinued products isn’t always the best idea). 

But if you simply change or delete a page without doing anything else, you will run into issues. You need to put in place a redirect to stop any visits to that page, reaching a dead end on your site. 

And, at least in most instances, it is a 301 redirect that you need to be implementing here. 

A 301 redirect is a permanent redirect that takes users (and search engines) to a new URL when the original page no longer exists. It is intended to be used when there are no plans to reverse the change. 

In practice, it looks like this:

Let’s say you have historically hosted your blog on a subdomain — https://blog.website.com — and have decided to move this into a subfolder — https://www.website.com/blog/.

That original blog will be indexed by Google, has been included in social posts and emails, and is probably bookmarked by visitors. It has been getting traffic, and you don’t want to lose that. 

If you simply delete the subdomain when you move the blog to the subfolder, users will see a 404 page when accessing any of the original URLs.

Not only is this bad practice and really poor user experience, but it will also result in search engines dropping the blog pages from their index — as far as they are aware, it no longer exists. 

But, if you put in place a 301 redirect, and anyone who visits the old URLs will be redirected to the new, and search engines will update the pages in their index over time. 

In short, you will keep your traffic.

301 vs. 302 vs. 307 Redirects

You may also have come across 302 redirects and may think that they are the same thing. They are not.

Whereas a 301 is a permanent redirect, a 302 is a temporary one and should be used when a page moves temporarily. 

That said, 302 redirects absolutely have their place and are commonly used in instances such as testing changes or getting customer feedback, and the original is expected to come back.

Historically, using a 302 redirect instead of a 301 redirect would see any rankings that the original page had lost as they were thought not to pass PageRank. However, in 2016 Google’s John Mueller confirmed that this isn’t (at least any longer) the case and that 302s do in fact pass PageRank.

You can see Mueller’s comment below:

A 307 redirect is also used as a temporary redirect. The difference between a 302 and a 307 is the HTTP method remains unchanged when using a 307 redirect. With a 302, the HTTP method can change. 

If the change is permanent, use a 301.

What Are Wildcard Redirects and Should You Use Them?

Wildcard redirects allow you to redirect all of the URLs in a folder on your site to another with a single redirect rule.

Keeping our example of a blog migration from subdomain to subfolder, a wildcard redirect could be used to:

  • Redirect https://blog.website.com to https://www.website.com/blog/
  • Redirect https://blog.website.com/blog-post/ to https://www.website.com/blog/post-name/

Or, to give another example, you could use a wildcard redirect to change the URL structure of a category on an eCommerce store, redirecting all of the product and subcategory URLs within that category to the new:

  • Redirect https://www.website.com/old-category/ to https://www.website.com/new-category/
  • Redirect https://www.website.com/old-category/product/  to https://www.website.com/new-category/product/
  • Redirect https://www.website.com/old-category/subcategory/ to  https://www.website.com/new-category/subcategory/

In this example, only those URLs within the /old-category/ subfolder would be redirected; any in, let's say, /different-category/ would not be.

  • Wildcard redirects can be used when there is a single variable changing — for example, one folder name. The rest of the URL path must be kept consistent to use a wildcard. 
  • If you are changing URLs in bulk and there is only a single change being made in the path, wildcards can be an option to redirect all those within a subfolder without the need to implement an individual redirect for each. 
  • If there is more than one variable in a path changing, redirects wouldn't be suitable. 

When Should You Use a 301 Redirect?

There are many instances when you should use a 301 redirect. Let's look at some of the most common reasons.

Permanently Moving a Page to a New URL

From https://www.website.com/old-page-name/ to https://www.website.com/new-page-name/

There are times when you will need to change the URL of a page on your site.

It could be that a product name has changed slightly and you need to update it, or you embark on a project to better categorize your site's pages into topic clusters, or have another reason entirely (the reasons are endless).

A 301 redirect will ensure that users are redirected to the new URL and that search engines index the new page and maintain any ranking positions held.

Deleting Site Pages

There is often confusion as to what best-practice says you should do when you delete a page from your site.

Should you 301 redirect to another URL, or should you leave it to become a 404 page? Or even give it a 410 status?

Well, it depends.

Should You 301 Redirect, 404 or 410 a Page You Need to Remove?

404 or 410 errors are certainly not what users want to see. Neither are they really what Google wants to face when crawling your site.

The first question you need to ask yourself is whether the page that you are deleting has a near equivalent somewhere else within your site. One that would make sense for a user to be redirected to if they clicked on the original URL?

If the answer is yes, your best option is going to be to implement a 301 redirect.

If the answer is no, on the other hand, you will need to figure out what the best course of action is.

And, this depends on the reason why you are deleting the page in the first place.

If there really is no alternative page to redirect to, the page needs to be deleted, and it won't be coming back, the best option would be to implement a ‘410’ header that tells the browser and search engines that the page has been deleted. 

A 404 error means that the content cannot be found, whereas a 410 status specifically says that it has been deleted.

delete page 301 flowchart for redirects

Here is a quick flowchart to help you make the decision as to what would work best:

Migrating Your Site to a New Domain

From https://www.website.com to https://www.newwebsite.com 

Businesses sometimes need to change their domain name for one of a few reasons. 

It could be that they are migrating from a .com TLD to a .co.uk ccTLD, as an example, or have rebranded and need to move to a domain name that reflects the new business name.

A 301 redirect is needed when migrating from one domain name to another and should be accompanied by using Google Search Console's ' change of address' tool.

Changing Your Site Structure

From https://www.website.com/old-category/post/ to https://www.website.com/new-category/post/

You might need to change your site's structure to improve your overall SEO performance and make it easier to categorize content and for Google to understand how your pages are related to one another. 

The same concept applies to changing any subfolder structure on your site, whether that is blog categories, eCommerce categories, or other folders. 

Moving From Non-WWW to WWW URLs (or Resolving Duplication Issues)

From https://website.com to https://www.website.com

While there is no SEO benefit to be had from one or another, you need to make sure your site sits on either non-www or www URLs. 

If you find that your site can be accessed both with non-www and www URLs, a 301 redirect from one to the other, based on your preference, should be used to remove duplication issues.

Switching from HTTP to HTTPS

From http://www.website.com to https://www.website.com

There is still only 60% of the web using the HTTPS protocol, which clearly means that there is 40% that haven't made the change yet.

If you are switching your URLs from HTTP to HTTPS, you will need to use a 301 redirect to make sure Google properly indexes the new protocol and that users are sent to the right page rather than a 404, which is what would happen without putting this in place.

Merging Two (or More) Domains

From https://www.website.de to https://www.website.com/de/

Let's say you have decided that your international SEO strategy will see you merge a number of ccTLDs into subfolders of your main .com domain. 

This requires the same redirect process as changing your domain name, just redirecting into a folder rather than root domain, and will need you to use Google Search Console's 'change of address' tool, again, doing so to the country-specific subfolder level.

Resolving 'Trailing Slash' Issues

 From https://www.website.com/page-name to https://www.website.com/page-name/

Were you aware that variants of a URL with and without a trailing slash are actually different pages and will be seen as so by Google?

You need to make sure that your site uses a consistent approach to handling trailing slashes on page URLs (which you choose to go with is your choice, but historically the web used trailing slashes), and 301 redirect one to the other with a sitewide redirect rule. 

Resolving 'Upper-Case vs. Lower-Case' Issues

From https://www.website.com/Page-Name/ to https://www.website.com/page-name/

Just as trailing slash and non-trailing slash variants of a URL are seen as different pages, so are different versions that include upper-case and lower-case letters.

Again, even one capitalized letter in a URL means that it is seen as a different page to its lower-case counterpart and can be seen as a duplicate, and using 301 redirects is best practice here to resolve issues where different variants are indexed.

It makes sense to use lower-case for your URLs and not to mix upper-case and lower-case. 

How to Use 301 Redirects to Boost Your SEO Performance

301 redirects have a number of uses as part of your SEO strategy. They can help you overcome issues that could hold back your site's organic visibility or help you to make the most of the opportunities that exist to drive growth. 

Here are some of the most common ways that 301s can be used to boost your SEO performance:

Merging or Redirecting Thin Content Pages 

One of the most impactful ways you can use 301 redirects to power up your SEO performance is to use it as part of a content pruning task — merging thin content pages together to create great pieces that cover a topic in-depth.

 As Kevin Indig comments in his step-by-step guide to SEO pruning:

Panda and other Google algorithms have taught us that quality - not quantity - is the name of the game. An effective approach to keeping quality high is “SEO pruning”: cutting off or editing underperforming pages to make a site stronger. You would rather have little but great content.

— Kevin Indig

Once you have identified underperforming pages on your site, those that haven't earned any backlinks or traffic (usually because they don't rank in prominent positions on the SERPs) should either be redirected to pages that serve the same intent or multiple merged together to create something that deserves to rank.

Migrating Your Blog From a Subdomain to a Subfolder

We talked about migrating your blog from a subdomain to a subfolder in one of the examples above, and this is one of the most common ways you can use 301 redirects for quick SEO wins.

Content that sits on your blog is often powerful to your SEO strategy. 

Not only does in-depth content help to establish you as an authority and position you as an expert source on a topic in the eyes of the algorithm, but it is also common that this content earns a large percentage of your site's links

Why would you want great links pointing to a subdomain when they could be working harder to power up your main site's SEO performance by having the blog in the site's root?

Unless there are technical restrictions that prevent you from doing so, migrating your company's blog from a subdomain into a subfolder should be seen as a priority task. 

In fact, if you need some convincing, just take a look at the results that Gianluca Fiorelli shared on Twitter after he merged a blog from a subdomain into the root of the site as a subfolder:

That says it all, doesn't it?

Resolving Keyword Cannibalization Issues

Let's get one thing straight, keyword cannibalization isn't simply the case that having more than one page targeting the same keyword will prevent either from ranking.

Rather, it is an issue that is all about intent. Only when the intent of two (or more) pages is the same are you competing against yourself and suffering from cannibalization issues.

That said, using 301 redirects is one of the main ways to clean up problems caused by cannibalization in cases when there is no reason to keep all of the competing pages. 

Merging Multiple Websites Into One

By now, you have seen the SEO wins that are possible when migrating a blog from a subdomain to a subfolder on your site. 

If your business operates multiple websites, let's say you run a hotel chain and have a different site for each hotel, it might make sense to merge these all into one, just like Marriott does. 

Example of merging sites

Again, you are combining the authority and equity of multiple domain properties into one, resulting in a stronger site that drives quick win successes (keep in mind, to have the success Marriott has, your SEO strategies need to be on point).

Managing Discontinued Products

How discontinued products are managed is one part of SEO that is often met with different opinions. 

Opinion 1: if a product goes out of stock due to being discontinued and isn't likely to ever come back in stock, it is often recommended that you 301 redirect the product to the next best alternative. This is far preferable to simply deleting the page and letting users face a 404 when they try to buy an old product they have stumbled across — and this is common.

But a redirect won't maintain the rankings or visibility of the discontinued product, transferring any equity to the target page.

Opinion 2: There is often interest in products long after they are discontinued, so the other argument is that these product pages should remain in place, at least for some time, with alternatives clearly displayed, rather than removing and redirecting.

Another option, you could also turn this page into a comparison page, "2019 Product vs. 2020 Product" — people compare the features of products often. Then included related products.

How to Implement 301 Redirects

So now you know what 301 redirects are and when you should use them, but how do you implement them?

Unfortunately, there is no single way to do this — it very much depends upon your server and the CMS that you use. 

But here is how to implement 301s across some of the common set-ups you will likely be using.

301 Redirects on Apache Servers

If your site runs on an Apache server, you need to edit your site's .htaccess file to implement redirects.

Going into the root of your site via an FTP client can quickly help you identify which way you need to implement 301s, if you are unsure.

If you see a .htaccess file, it runs Apache.

To add a redirect to the file, use the following examples to:

Redirect a Single Page

Redirect 301 /old-page/ /new-page/

Redirect An Entire Domain to Another

Redirect 301 / https://www.newwebsite.com/

Redirect An Entire Site to a Subfolder

Redirect 301 / https://www.website.com/subfolder/

Redirect A Subfolder to a Different Domain

Redirect 301 /subfolder https://www.nnewwebsite.com/

Redirect A Site Directory After a URL Change

Options +FollowSymLinks RewriteEngine On RewriteRule ^(.*)/old-category/(.*)$ $1/new-category/$2 [R,L]

Redirect From Non-WWW to WWW

RewriteEngine on
RewriteBase /
rewritecond %{http_host} ^website.com [nc]
rewriterule ^(.*)$ http://www.website.com/$1 [r=301,nc]

Redirect from HTTP to HTTPS

RewriteEngine on
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Redirect to Trailing-Slash URLs

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_URI} !(.*)/$ 
RewriteRule ^(.*)$ http://www.website.com/$1/ [R=301,L]

301 Redirects on Nginx 

To create a permanent 301 redirect on Nginx, you need to add a line to your .conf file that is typically round in the root of your server. 

Some of the common lines you might need to use are:

Redirect a Single Page

server {
# Permanent redirect to an individual page
rewrite ^/old-page$ http://www.website.com/new-page permanent;

Redirect An Entire Domain to Another

server {
# Permanent redirect to new URL
server_name website.com;
rewrite ^/(.*)$ http://newwebsite.com/$1 permanent;

Redirect from HTTP to HTTPS

server {
listen 80;
server_name website.com www.website.com;
return 301 https://website.com$request_uri;

Redirect From Non-WWW to WWW

server {
# Permanent redirect to www
server_name website.com;
rewrite ^/(.*)$ http://www.website.com/$1 permanent;

301 Redirects on a Windows Server 

If your site runs on a Windows server in ASP.NET, you need to add redirects into the web.config file that you should find in the site root.

Here is how to implement the most common 301 redirect types:

Redirect a Single Page

<location path="old-page">
<httpRedirect enabled="true" destination="http://www.website.com/new-page/" httpResponseStatus="Permanent" />

Redirect An Entire Domain to Another

<httpRedirect enabled="true" destination="http://www.newwebsite.com/" />

Redirect from HTTP to HTTPS

<rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
<match url="(.*)" /> 
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />

Redirect from Non-WWW to WWW

<rule name="Redirect http://website.com to http://www.website.com HTTP" patternSyntax="ECMAScript" stopProcessing="true">
<match url=".*"></match>
<add input="{HTTP_HOST}" pattern="^website.com$"></add>
<add input="{HTTPS}" pattern="off"></add>
<action type="Redirect" url="http://www.website.com/{R:0}" redirectType="Permanent" appendQueryString="true"></action>

301 Redirects on WordPress Sites

If your site runs on WordPress, you are lucky because implementing 301 redirects is really simple and straightforward. 

If you are using the Yoast SEO Premium plugin, you will find a built-in redirects manager that you can use to implement redirects. If you are using the free version of Yoast SEO or another plugin that doesn't offer redirects, you need to install a dedicated redirects plugin. 

Redirection is the most popular redirect manager currently out there for WordPress, having more than 1 million active installations at the time of writing. You can be adding your redirects in minutes; it is very easy to use. 

Redirection WordPress plugin for 301 redirects

If you are using an alternative to Yoast such as RankMath, you will find a redirect manager included within the plugin that also lets you serve 410 headers and more.

Rank Math 301 redirect plugin screenshot

301 Redirects on Magento Stores

If your eCommerce store runs on Magento, the functionality to add 301 redirects is built into the platform.

Here is how to create them...

Magento 1

If you are running Magento 1, navigate to Catalog > URL Rewrite Management

Magento rewrite management for 301 redirects

You will now see any redirects that have previously been created.

Go ahead and 'add URL rewrite.'

Select a 'custom' rewrite.

Custom Magento rewrite option

Fill out the required URL rewrite information as follows:

URL rewrite information for 301 redirects

ID Path = The name of your rewrite that's used for admin purposes only.
Request Path = The original / from URL
Target Path = The new / target URL
Redirect = Permanent (301)
Description =Any description you want to add for the redirect

Magento 2

Firstly, navigate to URL Rewrites:

Marketing > SEO & Search > URL Rewrites

Magento 2 Rewrites options for 301 redirects

Go ahead and 'add URL rewrite' and fill out the required URL rewrite information as follows:

Magento 2 Rewrite Information for 301
Image Credit: Magefan

Create URL Rewrite: Custom
Store = The store you want to add the redirect for
Request Path = The original / from URL
Target Path = The new / target URL
Redirect Type = Permanent (301)
Description = Any description you want to add for the redirect

301 Redirects on Shopify Stores

As with WordPress and Magento, implementing 301 redirects on a Shopify store is pretty simple and straightforward.

Head to Sales Channels > Online Store > Navigation

You will then see a pretty discreet 'URL Redirects' link at the top of the page. Go ahead and click it.

Shopify 301 Redirects button

You can now 'Create URL redirect.'

It is then as simple as adding your 'from' and 'to' URLs and saving the redirect. Simple as that.

Shopify URL Redirect fields to add URLs

301 Redirects on BigCommerce

If you are running an eCommerce store on BigCommerce, here is how to add 301 redirects:

Navigate to Server Settings › 301 Redirects.

Add a redirect and add in your old URL.

BigCommerce 301 redirect option
Image Credit: BigCommerce

Choose either a manual link (where you enter the new URL to redirect to) or dynamic link (you can select a page or category, and the redirect will automatically update if you change this page at a later date) as the redirect type.

Choosing a BigCommerce redirect type
Image Credit: BigCommerce

Enter your new page's URL or choose a page to redirect to if you selected the dynamic link option above.

Adding a URL for redirect option
Image Credit: BigCommerce

redirect dynamic option
Image Credit: BigCommerce

Common 301 Redirect Mistakes & How to Avoid Them

It is easy to make a mistake when implementing 301 redirects, often without meaning to, and here are some of the more commonly made mistakes and how you can avoid them.

Allowing Pages to 404

In most cases, you shouldn't be letting deleted pages return a 404 code, but should rather be implementing 301 redirects to point users and search engines to the new target page.

You can use the SEMrush Site Audit tool to identify pages that return a 404 (and other 4XX) error to enable you to go and resolve these using redirects.

site audit 404 list

Using 302 Instead of 301 Redirects

As covered above, 301 redirects should be used when the change is permanent and 302s when the change is temporary; however, these are often used incorrectly. 

Again, the Site Audit tool can help you to find these, with them marked as 'pages that have temporary redirects.'

temporary redirect checks

You should then go and update these redirects to 301s from 302s unless it makes sense for them to be set to temporary.

Using JavaScript for Redirection Without a Proper Set Up

JavaScript can be used for redirects, and if you have no other choice they can be used; they are often used when people don’t have access to their website’s server.

However, they are not the optimal choice due to the fact that search engines need to render a page to find the redirect. Many sites disallow Googlebot from crawling a site’s CSS or JS files, and as a result, the page can't be rendered.

Using a 301, 302, or 307 redirect is typically recommended to avoid any issues.

Redirecting to a Page That Has A Different Intent to the Original

You shouldn't be redirecting simply for the sake of doing so, as this can have a negative impact on your site's user experience. 

You should only be redirecting to similar pages, and adding redirects that point to those that have a totally different intent than the original is considered bad practice and should be avoided wherever possible. 

If you find broken internal links through a site crawl with the Site Audit tool, you should not simply be using 301 redirects to resolve these, as you're creating an unnecessary redirect chain.

Rather, update the target of the broken link first, then add a redirect to the correct page once this has been done.

broken internal link redirects

Redirect Chains & Loops

Two common examples where 301 redirects are used improperly are redirect chains and loops. Long redirect chains and infinite loops make it difficult for search engines to crawl your site and can also slow down your site's load speed. 

You can identify redirect chains & loops using the SEMrush Site Audit tool and go ahead and remove the chains and loops by reworking your redirects to point from the first to the last URL in the series.

redirect chains and loops

There you go; everything you need to know about using 301 redirects. 

While they may seem a simple topic, there is more to them than many think, especially when you take into account not only the different usage scenarios and the different ways that they have to be implemented based on your site's set up.

Understanding 301 redirects is an essential part of any SEOs knowledge, but by taking your time to check and double-check the way you're using them, you'll be able to avoid mistakes and use them in the right situations. 

Author Photo
US Personality of the Year 2017 Winner and die-hard Star Wars fan. Herder of cats. Non-cook. Find me on Twitter @SEOaware.