Ultimate Guide to Redirects in Technical SEO

characters flying between planets in space banner

Redirects are used to forward users and search engine crawlers from one URL to another. 

You use redirects when you make changes to existing URLs – common use cases include: 

  • merging websites, 
  • changing, updating, or removing content,
  • fixing pages returning 404 status codes, 
  • changing site’s information architecture, and
  • conducting a site migration. 

Any redirection mistakes – or not implementing redirects despite it being necessary – can cause severe SEO issues. Google may not associate ranking signals from the original page with the new one, leading to drops in rankings and, consequently, losing traffic.

That’s why analyzing all of your website’s redirects is an integral part of our technical SEO services at Onely.

This article will help you understand how redirects can be implemented to your website’s benefit.

Read the article to find out:

  • when and why you should use redirects, 
  • different types of redirects and their use cases, 
  • best practices for redirects,
  • methods to audit, implement and test them.

What are redirects

Redirects are used for forwarding users and search engines from the URL they initially wanted to visit onto a different one. 

They can help you move traffic from URLs you don’t want anyone to visit, such as URLs responding with 404 (error) status codes or containing outdated or changed content.

By implementing redirects, you provide a positive user experience to visitors who are trying to access a page that, without a redirect, could display an error. Error pages cause users to bounce or leave the page, making them less likely to return to your site. 

From an SEO perspective, redirects are a way to preserve the ranking signals from the original page, which can help maintain the rankings.

Google uses ranking signals, many of which we don’t know about, to determine how to rank pages. Google’s ranking signals include PageRank (the value and quantity of links pointing to a page), mobile-friendliness, and web performance. By implementing redirects, the ranking signals accumulated for the old page can be transferred to the new page. 

The difference between canonicals and redirects

If you have ever used canonical tags, you might be wondering about the difference in use cases between redirects and canonicalization.

Using the HTML rel=” canonical” tag helps search engines understand which page from a set of similar pages is the canonical one – the original page that you want to be shown in search results.

On the surface, both canonical tags and redirects can help you avoid issues with duplicate content and consolidate different URL versions.

But there are crucial differences between how redirects and canonicals work, and they should not be used interchangeably. 

A redirect is used when a page does not exist anymore or has changed. Meanwhile, with a canonical tag implemented, another copy of that page still exists. You use a canonical tag to specify to search engines which URL version is the primary one.

Also, remember that Google can ignore improperly created canonical tags. If Google ignores your canonical tag, you can spot it thanks to the “Duplicate, Google chose different canonical than user” status in GSC.

Redirects should be preferred over canonicals to consolidate URL properties and eliminate issues with duplicate content. Google can choose the canonical version based on the tag, but it can also use a different page if it considers it better. Meanwhile, if a redirect is implemented correctly, Google won’t choose another URL instead.

When redirects are necessary

Generally, redirects are essential if the original URL is:

  • indexed and ranks, 
  • frequently visited by users, 
  • linked to from your site and external sources, 
  • used in other content, such as your newsletter. 

However, if you have pages that are not valuable or popular, it’s not critical to fix them.

Here is what Google says about 404 errors: “In general, 404 errors won’t impact your site’s search performance, and you can safely ignore them if you’re certain that the URLs should not exist on your site”.

In most cases, the only situation where a 404 would hurt your SEO is if you have links from other sites pointing to an error page. You should then implement a redirect to preserve the accumulated PageRank.

There are ways to enhance the experience of visitors arriving at your error pages. For instance, you can guide them to a better location or suggest their next steps. See our guide on how to create a great 404 page.

Struggling with 404 pages on your website?

Read our article on how to fix the “Not found (404)” in Google Search Console.

Types of redirects

There are two types of redirects:

  • Server-side redirects, and
  • Client-side redirects.

The difference lies in where the redirection occurs – the server or the client.

Server-side redirects relate to HTTP status codes, which are the server’s responses to a browser’s request. 3xx status codes are used for redirecting.

Client-side redirects are implemented by inserting code inside a page’s HTML.

Let’s look at the most common examples of both redirect types, their characteristics, and use cases.

Server-side redirects

The most common server-side redirects are 301 and 302. There are also their HTTP 1.1 versions – 307 and 308. 

Let’s focus on 301 and 302 redirects, recommendations on how and when to use them, and how search engines treat them. I will also explain what the other HTTP request codes indicate and when you may encounter them.

301 redirects

301 redirects are usually the most recommended redirection method for SEO. They indicate that a URL has been permanently redirected to a new destination.

You may decide that one or more of your pages should be removed or changed. However, problems would arise if you simply deleted or changed it, especially if these pages get a lot of traffic and are valuable for your business.

If you are also not planning on using the original URL anymore, using a 301 redirect will be the right call.

Use cases for 301 redirects

There are several use cases for 301 redirects, some of which can include:

  • Making changes to your content, e.g., updating or deleting a piece of content or consolidating it,
  • Moving your site to a new domain,
  • Changing the structure of your URL, e.g., by adjusting your site architecture or changing the subdomain or subdirectory structure of your URLs,
  • Moving from HTTP to HTTPS protocol,
  • Changing your CMS,
  • Merging websites,
  • Any cases when you want to redirect users and search engines from URLs with 404 statuses.
SEO impact of 301 redirects

301 redirects tell search engines that the page has changed location, and the content can be found at the new URL. 

In this case, search engines should drop the old URL from the index and transfer as much PageRank as possible from the original URL to the new one. You can then also maintain your rankings, which will allow you to keep your traffic and conversions.

We don’t know how much of the accumulated ranking signals can get lost with a 301 redirect but, if the redirect works properly, it’s the best way to salvage these signals.

However, ensure that each time you create a 301 redirect to a new URL, it’s to a page that matches the content of the old URL as closely as possible. It will help you minimize any adverse effect a redirect might have on your search visibility.  

How long should you keep your 301

Keep in mind that the process of discovering the updated URL can take some time, depending on how often search engines crawl your pages. 

In a recent video, Google’s search advocate, John Mueller, advised:

“When a URL changes, our systems need to see the change in the form of a redirect for at least a few times to record that change.

To be certain that a redirect has been seen a few times, we recommend keeping the redirect in place for at least one year.”

However, at Onely, we recommend that you don’t remove redirects at all, to avoid issues if search engines don’t register the change on your URL for a while.

Ensuring Google sees the redirected URL as canonical

In another video, when asked about ways to ensure Google treats the new URL as the canonical version, John stated that using a 301 redirect is not enough because it’s merely a signal:

“You’re telling us you’d prefer to have the destination page indexed rather than the originating one. And that’s fine. However, we use lots of factors for canonicalization, not just redirects…”

As John explains further:

“If everything aligns we’ll focus on the destination page. To make that easier, make sure that you update the internal links, the sitemap files, and other references to the originating page so that they all point to the destination page.”

302 redirects

A 302 redirect indicates that a URL has moved temporarily. 

It tells visitors and search engines that this URL is not available at this location right now, but it will be available again. 

Use cases for 302 redirects

You should opt for a 302 redirect if you are:

  • Redesigning or updating content on your pages but plan to bring them back up, 
  • Fixing a broken URL and temporarily redirecting its traffic to a different destination,
  • Redirecting product pages, e.g., for products that are temporarily out of stock, available seasonally or special offers, 
  • A/B testing – e.g., if you are testing a new website template,
  • Geotargeting – if you want to redirect users to a different URL based on their location,
  • Device targeting – to redirect users based on their device.
SEO impact of 302 redirects

Unlike 301, it is more problematic to transfer ranking signals to a new URL with a 302 redirect. 

Previously, many SEOs believed that 302 redirects could not pass PageRank. However, John Mueller explained in 2016 that it was a myth. 

Generally, Google views 302 redirects as temporary, in which case it may not transfer all ranking signals to the target URL. But, if a 302 is in place for a while, Google may see it as the canonical version and effectively treat a 302 redirect like it would a 301.

The most important rule for implementing 302s is to keep them temporarily and remove the redirect as soon as the original URL is available again.

307 and 308 redirects

307s and 308s are HTTP 1.1 equivalents of 301s and 302s and work similarly. 307 is a temporary redirect, while a 308 indicates that a page has moved permanently. 

The only difference between 301s and 302s vs. 307s and 308s is that using the latter guarantee that the method and body will not be altered when the redirected request is made. 

In other words, 301s and 302s can occasionally be incorrectly changed from a POST to a GET method, where POST methods send data to the server and GET are used to request data. To better illustrate this difference: a GET method could be used to receive data by a search page, while a POST method can be used in a form where you change a password.

Google’s guidelines state that 307s and 308s are treated just like 301s and 302s are.

Client-side redirects

As mentioned, client-side redirects occur in the browser. There are two client-side redirection methods:

  • Meta refresh, and
  • JavaScript.

But there are a few drawbacks to using them. 

Overall, client-side redirects are only recommended if server-side solutions are impossible to implement, e.g., you don’t have access to your server. 

Let’s look at these two redirect methods and learn how to implement them and how they impact your URLs.

Meta refresh

In meta refresh redirect, a meta tag should be placed in a page’s <head> section, telling the browser to move to another page after a specified time has passed. 

Here is what a sample code could look like:

<meta http-equiv="refresh" content="2; URL='https://www.onely.com/blog/javascript-redirects-and-seo/'" />

The number (2) specifies the number of seconds before the browser redirects to the specified URL.

This redirection method is commonly used with a display message that says, “Click here if you are not redirected in five seconds,” in which case the redirection occurs after 5 seconds.

Google differentiates between instant and delayed meta refresh redirects. An instant one should have the number of seconds set to “0”, in which case Google will see it as a permanent redirect. A delayed one will have some number of seconds before redirecting, and Google says this redirect will be treated as temporary.

Even if Google correctly processes your redirect, this redirection method often creates a bad experience for users. First of all, it takes more time to process than server-side redirects. It can also appear spammy and confuse users because they did not initiate the redirection or were taken to a different page too quickly or slowly. 

Meta refresh will only be a suggested option in particular cases, like if you can’t access or use a .htaccess file, or you only want to redirect a single file in a multiple-file directory.

If you decide to use meta refresh, keep the delay to request a target URL to a minimum – preferably, set it to 0.

JavaScript redirects

Using JavaScript redirects is generally not SEO-friendly. Crawling and rendering JavaScript by Google remains a complex topic, and there are many guidelines to follow to help Google understand your JavaScript as best it can. 

Also, if Google does not view your JavaScript files as relevant for the page, it may not render JavaScript at all.

JavaScript redirects don’t give you an option to set an HTTP status code, so when the URL is requested, the server will respond with a 200 OK status. Hence, before redirection can occur, a page’s resources need to be downloaded and rendered. This causes the redirection process to take longer than the server-side solutions. By using JavaScript, the chances of all ranking signals passing to the new URL are also lower. 

But there are situations where JavaScript redirects are a viable option. One benefit of JavaScript redirects is that you can include additional logic. For example, you can use it to detect a user’s location or language and redirect based on this setting.

Be sure to check out our guide on JavaScript redirects that will give you a complete overview of implementing this method, its risks, and suggested use.

Are you struggling with optimizing JavaScript redirects on your own? Learn how our JavaScript SEO services can help you or read the ultimate guide to JavaScript SEO on our blog.

Which redirects are better for SEO?

The above-mentioned redirection types – HTTP, meta refresh (HTML), and JavaScript redirects – work differently and get picked up by search engines at different stages. 

Google can catch the server-side HTTP redirects during crawling. The bots can receive a 3xx response and understand that the page has moved to a different location. This lets them get to the new URL much faster.

However, with client-side redirects, Google can only detect a redirect at the rendering stage. This adds more complicated steps to the process and makes it significantly longer. 

Client-side redirects do not guarantee that Google will index the redirection properly. In this case, the old URLs still exist, unlike with server-side redirects. 

There is no way to indicate an HTTP status code with client-side redirects, which is a significant downside that makes it harder for search engines to decide how the redirect should be treated.

It’s worth adding that meta refresh would be executed before a JavaScript redirect. Additionally, JavaScript needs to be executed for a JavaScript redirect to be followed, making it the least favorable redirection method. 

Use server-side redirects whenever possible. If they are not available, go for client-side redirects.

Best practices for implementing redirects

If the redirects are correctly constructed, search engines will associate ranking signals of the old URLs with the new ones. This way, you can maintain your rankings, traffic, and revenue. 

Let’s look at guidelines you should follow in your redirects.

Avoid redirect chains and loops

Redirect chains occur when there is more than one redirect between the original URL and the destination one. This adds the time needed to reach the destination page. 

If you have three URLs – A, B, and C – don’t create redirections like this:

URL A → URL B

URL B → URL C

Instead, ensure there is always only one redirect:

URL A → URL C

URL B → URL C

Redirect loops occur when the destination URL can’t be reached. For example, it could happen if redirects are implemented like this:

URL A → URL B

URL B → URL A

As a result, these URLs redirect to each other, and the destination cannot be accessed.

Each redirect creates an additional HTTP request to the server. Using one redirect won’t impact the performance too much, but each additional redirect will negatively impact the loading time, hence providing a worse user experience.

Use 301 redirects for potential duplicate content problems

Your URLs could exist in different formats, which can lead to duplicate content issues. 

For example, there could be versions of URLs:

  • With and without www,
  • With and without trailing slashes (/),
  • With HTTP and HTTPS.

To avoid duplicate content issues, use 301 redirects to point to a canonical version of that URL.

Redirect to thematically relevant pages

Your redirects should always be to pages that are the closest possible matches to the old URLs.

When choosing the most appropriate page to redirect to, think about what a user initially expected to find and redirect them to content that will address their search intent. 

For example, if a person was trying to visit a page for a specific pair of shoes you no longer sell, you can redirect them to a page with the related shoe category. 

Redirecting a product’s page to the homepage is usually viewed as bad practice. Google may also see such URLs as 404s:

Address issues with broken links

There are likely internal and external links pointing to 404 pages on your site. You can use a tool like Ahrefs Site Explorer or Semrush backlinks analytics tool to find broken links.

  • Update internal links

Broken internal links don’t help search engines discover your content or identify what it is connected to. You should aim to update the internal links leading to 404 pages. Don’t implement redirects here – this way, you are avoiding an additional step for search engines and visitors.

  • Fix external links

With broken external links, you are missing out on important ranking signals. However, these links are out of your control, so you can’t simply update them. Instead, contact the sites linking to you and request that they change the link to a different URL. If this doesn’t work, you should 301 redirect the error pages to ones that work. 

Use 301 redirects for keyword cannibalization issues

If you find that more than one of your pages target the same user intent, consider redirecting them to the main piece of content that best addresses that intent. 

If necessary, you can also update the main piece if any information could make it more comprehensive and then implement redirection.

Prepare a redirection strategy

Having a redirection strategy is especially important before conducting a site migration. Start by creating a list of all your legacy URLs that won’t exist after the migration.

You can access them in a few ways:

  • Export URLs from your XML sitemap,
  • Use a crawler to find and collect all your URLs.

When you have a list of all your URLs, you should map them to determine where each should be redirected.

You can redirect the pages based on shared patterns between old and new URLs, such as page titles or product codes. Ensure these patterns contain unique identifiers to reduce the risk of mistakes.

When preparing a strategy, be sure the URLs you are mapping are thematically related, and there are no redirection chains – or, at least, the number of redirects is kept to a minimum.

Manage discontinued products

The strategy for implementing redirects for discontinued products depends on your situation.

If you have products that are out of stock and won’t return, it’s best to 301 redirect these pages to the closest alternatives.

But if the discontinued products generate interest and traffic, it may be a better option to keep the same URL and simply change the page. It can then additionally display other offers for related available products, or you can turn it into a comparison article of the discontinued product and its alternatives.

How to check if your site’s redirects are set up correctly

To learn if your redirects are set up correctly, start with an audit of your site’s redirects. This solution is especially useful if you have a large site. 

You will then know if any URLs need to be fixed and, if required, where to implement redirects.

First, access all your URLs, either by exporting URLs in your sitemap or by crawling your site and extracting all URLs. You can then save them in a .csv file. 

The list of detected URLs with redirects is also available in your Google Search Console. In most cases, when you properly redirected your pages, you’ll find them in the “Page with redirect” status. However, when your redirects didn’t work, Google reports them within the “Redirect error” status.

Then, use a tool like Screaming Frog SEO Spider to audit the old URLs, check if the redirects work and whether any errors appear. Follow the steps in this article on auditing redirects in Screaming Frog.

If you have fewer redirects, you can manually test whether your redirect works correctly. Simply visit the old URL and see if you get redirected to the new URL. 

There are also tools you can use – for example, you can check temporary and permanent redirects in Google Search Console or Semrush’s Site Audit

If you want to test a specific URL, you can use a tool like httpstatus, which will show you the status codes and redirect chains. There is also Redirect Checker, which will check the HTTP codes, as well as meta refresh and JavaScript redirects. 

If you conduct a site migration, you should test your 301 redirects on the staging environment and after the new site is live. You can simply crawl your URLs and check if each of them 301 redirects to the specified target URL, which returns a 200 code. 

You should monitor your URLs after implementing redirects as well to ensure there are no errors and the redirects continue to work.

If you’re struggling to conduct a site migration, check out our website migration services to see how we can help.

How to implement redirects?

There are a few ways to implement redirects based on your server or the CMS you’re using.

Common methods include implementing them on Apache or Nginx servers or using plugins available for WordPress, Shopify, or Magento.

If the outlined methods do not apply to you, you can find your hosting’s or CDN platform’s guides for directions on implementing redirects. Most of them offer an easy way to manage redirects through their admin panels. For example, here are the guides for DreamHost or Hostinger.

For other solutions for implementing redirects, be sure to read this article on redirecting pages.

Apache

If your site runs on an Apache server, you can implement redirects by accessing your .htaccess file in the server’s root folder. This file allows you to make configurations to your website’s details without altering the server configuration files. 

You can reach this file by accessing your server’s public_html directory using an FTP or File Manager. If you don’t have a .htaccess file, you can create one using any text editor, setting its name to “.htaccess” without an extension, and uploading it to public_html. 

Before making any changes to this file, create a backup of it. Any mistakes in it can lead to your content not displaying properly.

Here are some common examples of the different redirection directives you can implement.

To 301 redirect an URL to another one, use this code:

Redirect 301 /old-page.html https://website/new-page.html

Since the command resides in the root server of that domain, there is no need to include the full URL of the old page here. But note that although you might be redirecting pages on the same domain, you must provide the full URL for the destination. 

If you want to redirect an URL with a 302 status code, just change the redirect to “Redirect 302.

If you want to permanently redirect an entire domain to another, do it like this:

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

If your URL changes from HTTP to HTTPS, use this:

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

In this case, you first turn on the RewriteEngine module in the .htaccess file, which is necessary for the conditions to work, and then specify the conditions.

You can also redirect an old file path to a new one:

Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html

Another way to use a .htaccess file is to redirect users to a custom 404 page. You can do it by implementing the following code:

ErrorDocument 404 /error/pagenotfound.html

Here, /error/pagenotfound.html should point to the location of your 404 page.

If you’re unsure how to implement redirects in .htaccess files and how they work, check out this Apache Tutorial and their URL Rewriting Guide

You can also follow this guide on setting up a .htaccess file on Apache.

Nginx

If your server runs Nginx, you can manage your redirects in the `nginx.conf` file by adding a server block to handle redirect requests.

This code sample would result in a redirect to a new URL:

server {
    listen 80;
    listen 443 ssl;
    server_name www.old-name.com;
    return 301 $scheme://www.new-name.com$request_uri;
}

Check out this guide on creating Nginx rewrite rules to learn how to create these requests.

Plugins

You can use a CMS plugin, which is a way to automate your redirect implementation, making the process faster, especially if you have a large website. 

Most CMS or eCommerce platforms offer a range of redirection plugins.

WordPress

Here are some popular plugins that you can use for WordPress:

Redirection – It will let you manage 301 redirects and follow any 404 errors your site may have. Use it for both sites with just a few redirects and those with thousands of redirects. 

301 Redirects – This plugin lets you manage and create 301, 302, and 307 redirects. It also keeps a log of your 404 errors. If you have a lot of pages to redirect, this tool lets you bulk redirect even thousands of URLs.

Safe Redirect Manager – Using this plugin, you can create 301 and 302 redirects, though it doesn’t offer the option to bulk redirect, so it’s recommended for smaller sites. 

You can also consider general SEO plugins, such as Yoast or All in One SEO, which offer this functionality. 

Shopify

If you are using Shopify, you can use one of the available apps, such as:

Easy Redirects by ESC – This app lets you manage your 301 redirects and 404 error pages, including bulk redirects. It’s a tool that will be helpful if you are migrating your store between platforms or adjusting your site structure or product pages.

Redirectify – It’s a Shopify app that will help you find and redirect 404 errors. 

Magento

If you are using Magento, you can set up 301 redirects in the URL Rewrites feature. 

Conclusion

Redirects are a way to preserve ranking signals, traffic, and conversions from pages where content has been removed or changed. Following the above-mentioned guidelines is key to maintaining your search performance, so pay special attention to implementing them correctly.

By implementing redirects, you take your users away from error pages that could cause a negative user experience, and you instruct search engines where they should go and how they should treat your changed URLs. 

Hi! I’m Bartosz, founder and Head of SEO @ Onely. Thank you for trusting us with your valuable time and I hope that you found the answers to your questions in this blogpost.

In case you are still wondering how to exactly move forward with fixing your website Technical SEO – check out our services page and schedule a free discovery call where we will do all the heavylifting for you.

Hope to talk to you soon!