The Definitive Guide to 301 Redirects

Guide to 301 redirects

301 redirects are an essential component of SEO and user experience in general. By mastering this process, you can prevent indexing issues, fix broken links and protect your website from duplicate content penalties from the search engines.

In this tutorial we will walk you through the basics as well as how to use 301 redirects like an SEO pro! So without further delay, let’s learn more about 301 redirects. 


What are 301 Redirects?

A 301 redirect code operates to let search engines know that content has permanently been moved to another URL. 301 redirects are permanent in nature, which means that they are beneficial in redirecting authority and relevance over to the redirect’s target.

If you want to redirect URLs, the chances are that you will need to use a 301 redirect. It ensures that the SEO of your site is not compromised and is, therefore, an essential tool to understand and implement.


The Importance of 301 Redirects

The main reason behind using a 301 redirect code is to ensure that moving your content does not negatively affect your SEO performance. 

Visitors and search engines will not figure out where your content has moved to if you fail to use 301 redirects. Without a 301 redirect code guiding them, visitors will find themselves on a 404 page, whereas search engines will be unable to send any built-up relevance/authority to the new URL you use. And as a result of this, your rankings will tank! 

To counter these potential problems, you must implement a 301 redirect and make it work.


How Do 301 Redirects Work?

This brings us to our next part, i.e., how do 301 redirect codes work. 

Here’s how a server responds to a page request:

Step 1: The client makes a request

A client requests a particular URL from a server.


Step 2: The server response

The server looks up the URL and finds that its content has been permanently moved – it replies with the new URL to the client.


Step 3: The client makes a new request

The client requests the new URL that the content has been moved to.


Step 4: The server responds to a new request

The server answers that everything is OK and, as a response, sends the URL’s assets.

Differentiating Between 301, 302, and 307 Redirects

It is easy to misconceive 301, 302, and 307 as the same thing when they aren’t! For this reason, you must have at least some understanding of what each of them does. 

The difference between 301 redirects and 302 redirects is that where 301 redirects are relevant for permanent changes, 302 redirects are used when a page is redirected temporarily. Similarly, a307 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.


Which Situations Call for 301 Redirects?

301 redirect codes can be used in the following situations: 

  • 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.
  • You’ve changed a page’s URL.
  • You’ve changed a subfolder’s URL.
  • You’ve switched from HTTP to HTTPS.

In short, you will use a 301 redirect code every time you move the content of value to ensure that the relevance and authority of it do not suffer and that neither visitors nor search engines end up on 404 error pages. 

How to Create 301 Redirects on Various Servers

Now that you have a considerable idea of what 301 redirects are and how they operate, it’s time to learn how to create them. We will discuss below what you need to do to create 301 redirects on different servers.


Apache

You need to keep in mind that redirect rules are kept in the .htaccess files for the Apache server. To redirect an /old-page/ to /new-page/ , simply use the following code:

 <IfModule mod_rewrite.c>
 RewriteEngine On
 RedirectMatch 301 /old-page/ /new-page/
 </IfModule> 

nginx

For the nginx server, the redirects will be kept in your nginx.conf file. As an example, look at this:

server {rewrite ^/old-page/$ /new-page/ permanent;}


WordPress

You can also create a redirect code on WordPress. Of course, the simplest way of doing this would be to use a Redirection plugin. Using that plugin, you can quickly implement a redirect from /old-url/ to /new-url/. Follow the instructions below to execute it as seamlessly as possible!

  1. Log on to the WordPress admin environment.
  2. Go to Tools > Redirection.
  3. Fill in the URL you want to redirect in the Source URL field.
  4. Fill in the redirect’s target in the Target URL field.
  5. Hit the blue Add Redirect button, and you’re done.


Shopify

Creating 301 redirects on Shopify is extremely straightforward, considering that the Shopify SEO toolbox comes with an in-built redirect manager. If you happen to change URLs, Shopify will always ask you whether you want to add 301 redirections. 

To use this tool, follow these simple steps listed below:

  1. Log on to the Shopify admin console.
  2. Go to Online Store > Navigation > URL Redirects.
  3. Click on the blue Create URL redirect button.
  4. Define the redirect source URL in the Redirect from the field, and define the redirect target in. So, Redirect from /old-url/ to /new-url/


Advantages of Using 301 Redirects

301 redirects can be advantageous in multiple ways, especially for your SEO strategy. By combating some of the issues mentioned above, they can help you maintain your site’s organic visibility and help you boost growth opportunities. 301 redirects can help you in the following ways:


Merging/Redirecting Pages with Thin Content

One way that you can use 301 redirects to improve your SEO performance is to use it as a tool for “content pruning.” That means that 301 redirects can help you merge thin content pages to create great pieces covering a topic in-depth. 

The key is to find out which pages are the underperforming ones on your site (these will be ones that haven’t earned much traffic or backlinks.) They should then be redirected to pages that serve the same intent but are better performing or merged to create something likely to get a higher rank. 


Migrating Your Blog From a Subdomain to a Subfolder

This is one of the situations where 301 redirects come in to play and improve your SEO. Redirects can help you use your best links to power up your main site’s SEO performance. For this reason, migrating your company’s blog from a subdomain into a subfolder should be seen as a priority task – and 301 redirect codes can help you with just that.


Fixing Keyword Cannibalization

Keyword cannibalization is an issue that stems from intent – you’re only competing against yourself and going through cannibalization issues if the intent of two or more pages is the same. This issue can be resolved using 301 redirects- they will help you clean up problems caused by cannibalization, as well as ways to avoid them. 

Common SEO issues to avoid and how you can fix these with a 301 redirect


Allowing Pages to go to 404

The most common mistake that you can make is letting deleted pages return a 404. Identify pages that return a 404 (and other errors), and then implement a 301 redirect that points users and search engines to a new target page.

Using 302 In Place of 301 Redirects

Another mistake that you can easily make and avoid is using 302 redirects where a 301 redirect is needed. Use 301 for redirecting to permanent changes, whereas a 302 code should be used only for temporary changes. 


Using JavaScript for Redirection

If you have no other option (especially if you don’t have access to your website’s server), you can use JavaScripts for redirects by all means. However, keep in mind that JavaScripts are not ideal because search engines need to render a page to find the redirect. 

Many sites will prohibit Googlebot from crawling a site’s JS files, which will stop the page from being rendered. Therefore, a 301 redirect code is a much better option to avoid such issues.


Redirecting to a Page That Has A Different Intent 

Another mistake you can make is by implementing redirection to a page that doesn’t serve your original intent. 

Your purpose shouldn’t be to redirect simply for the sake of it. Doing that may adversely impact your site’s user experience and maybe even your ranking. Therefore, you should only be redirected to pages that have a similar intent between them. Remember, adding redirects that point to those pages with a completely different intent than the original is considered bad practice and should be avoided as much as possible. 


Not Updating Broken Internal Links

If there are any broken internal links on your site, you should not simply use 301 redirects to resolve these. If you do, you’re creating an unnecessary redirect chain that does not help your site’s success whatsoever! So, instead of doing that, you should update the target of the broken link first, then add a redirect to the correct page once this has been done.


Catch website problems before they affect your customers

Every day your website can face an increasing range of threats. Server problems, slow landing pages, broken links, frustrating mobile experiences, embarrassing spelling mistakes, changing SEO rules, 3rd party services breaking, or security issues that put your business at risk. 

Hexometer is like having your own QA team, monitoring your entire website 24/7 for availability, performance, user experience, SEO, health and security problems so you can focus on your business. Now that’s peace of mind

Get started in minutes – no software, proxies, or programming required

Scroll to Top