« Back to front page

Redirects: a beginner-friendly guide to changing URLs for SEO

From permanent 301s to temporary 302s (and more), redirects are crucial for migrating single webpages or whole domains. We explain what they are, how they work, and when to use them.

Done correctly, redirects can be a powerful tool in your technical SEO arsenal. They enable you to efficiently transfer webpages (or whole domains) from one location to another, while preserving search rankings and optimising user experience.

[Editor’s note: article updated 10/12/21]

Redirects can be a complex subject however: done incorrectly, they can lead to frustrating redirect chains, and even major loss of organic search traffic. Which is not what you want, obviously.

So with this beginner-friendly guide, we’ll cover:

If you’re totally new to this topic then we recommend you bookmark this page and read it through at your leisure. (Let us know if you think it’s missing anything!)

If you have a specific query, then use the links above to find the info you’re looking for.

What is a URL redirect?

A redirect tells web browsers that a page has moved from one URL to another location. They can be done in various ways, depending on context, and can be either temporary or permanent. Common ones include 301, 302 and JavaScript redirects.

Do redirects lose PageRank?

PageRank is the scoring method Google still uses to rank a webpage in search results, based on its popularity and importance.

Various Google employees have confirmed that there is no loss of PageRank:

  • In February 2016, webmaster trends analyst John Mueller confirmed in a Google+ Hangout that there is no PageRank loss for 302 redirects

  • His colleague Gary Illyes also confirmed this on Twitter:

30x redirects don't lose PageRank anymore.

— Gary 鯨理/경리 Illyes (@methode) July 26, 2016

There is however a significant caveat to both these statements: they only transfer full PageRank when they are implemented correctly. More on that topic below.

When should you redirect?

Maybe you just bought a new domain, and want to transfer your existing website over – yay! Or maybe you noticed that you have two similar blog articles, and want to consolidate them into one (usually a good idea).

In many such cases, Google itself explicitly recommends 301s and has established its own guidelines.

Further situations where it makes sense to use a URL redirect:

  • When different URLs lead to your homepage, for example, https://homepage.com, https://www.homepage.com, and https://www.homepage.com/homepage. In this case, you can select one URL as the URL to be indexed and redirect the other URLs to it to avoid duplicate content.

  • When you want to merge two websites onto 1 new domain. In this case, you can redirect the “old” URLs to the new URLs.

  • When you’ve reworked your website structure and/or changed URLs. In this case, for example, you may have created new directories or made others obsolete. If redirects aren’t set up, the server will return a 404 error code when retrieving the old URLs.

  • When you use geotargeting and want to automatically direct your visitors to the appropriate language and country version based on their location. Permanent redirects can be implemented to achieve this.

  • When you do affiliate marketing, and links to your website are tracked by an affiliate system. When clicking on the link, the user is redirected – almost unnoticed – to the affiliate provider’s tracking page, and then again redirected to your domain.

  • When you want to redirect users to a URL that targets a specific device. The redirects are temporary and a Vary Header must be used.

  • When you want to redirect http pages to a version that contains an SSL certificate (https) to avoid duplicate content.

  • When you want to redirect pages from your website without “www” to the version with “www” (or vice versa).

What types of URL redirects are there?

In general, there are two types: server-side and client-side. The most common server-side redirects are 301 and 302 (more on both of these below). Client-side redirects are usually done via JavaScript.

Server-side redirects

These occur when a HTTP request is made. This happens when a client (in other words, a browser or a bot) requests a URL, making a request to the server. The web server then delivers a status code.

In the case of server-side redirects, the server indicates that the requested document has been moved to another URL. The client then accesses this new URL and the user or bot is redirected to it.

The entire process of a server-side redirect takes only a fraction of a second and, depending on the type, goes relatively unnoticed. Search engines have to interpret each one and decide how to handle it.

New to status codes? You may want to check out this guide to status codes to learn about the most important ones and their consequences.

Client-side redirects

These are not executed by a server, but directly by a client, like a browser. Usually, server-side redirects are better, but in practice, there are some cases where client-side redirects make sense.

Google itself hints to client-side redirects in its Quality Guidelines, noting that they may be useful for JavaScript redirects.

“Using JavaScript to redirect users can be a legitimate practice. For example, if you redirect users to an internal page once they’re logged in, you can use JavaScript to do so.”

Good to know: something called a “meta content refresh” can also be used as client-side redirects, but these are to be handled with caution. In this case, a meta tag is set so that the browser redirects the URL to a specified website after a set time.

But beware: in the past, meta content refreshes were (ab)used for so-called “sneaky redirects” to manipulate web pages, so search engines like Google are critical of this practice now.

Get an overview of all redirects on your website with a Ryte Free account

Check my redirects

Which redirect is best for my situation?

Use Case Temporary or Permanent Cacheable Possible Status Codes
Website relaunch Permanent Yes 301
Changes to the URL structure Permanent Yes301
Geo targeting Temporary No302, 307
Affiliate campaign Temporary Depends on the intent 302
URL bundling Permanent Yes 301

301 redirect: “moved permanently”

In terms of SEO, 301s are very important. They transfer link equity (“link juice”) and all relevant ranking signals to the new target URL.

>> 301 vs. 302 redirects: everything you need to know <<

A 301 is a useful solution to prevent orphan pages or to bundle incoming links. You should use a 301 if:

  • You are moving a domain permanently

  • You are moving a document permanently

  • You change the page’s protocol (http to https)

  • You change the URL structure of your website permanently

A 301 is intended to be permanent. They are not suitable for temporary activations like seasonal products in your online store, or a short-lived promotional page.

How long should 301s remain active?

There is no one-size-fits-all answer. Even Google’s former Head of Search Quality, Matt Cutts, answered this question very evasively in 2011, and avoided giving a concrete answer.

It must be noted that Google needs time to realize that the old URLs have been moved to new ones. These new URLs must then be indexed and displayed instead of the old URLs. While this process can be completed within a few days for small websites with few subpages, it will take considerably longer for larger projects with several thousand URLs.

In the end, you should keep the redirects as long as necessary. It’s recommended to regularly test them via the site query in Google to check whether the new URLs have already been indexed and are stored in the cache.

How do I set up a 301?

There are a number of ways to implement 301s, but the most common method is via the .htaccess file of an Apache server.

This file is a set of instructions for the server to execute when an http-request occurs. To implement a 301 you need the Apache module “mod rewrite.” The file specifies the URL to which the client should be redirected. This configuration file is stored as a text document in the main directory, on the same level as the index.php or index.htm sites.

A .htaccess redirect for a single webpage looks like this:

RewriteEngine On
RewriteBase /
RewriteRule pageold.html pagenew.html [R=301]

If you have decided to move an entire domain, the code reads:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^http://olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

Additional methods to implement 301 redirects can be found here.

If you want to be sure everything has been implemented correctly, check your 301 redirects with a Ryte Free account.

Fixing duplicate content: canonical tag or redirect?

There are two common technical options available to avoid duplicate content: the canonical tag and the 301. While the canonical tag is an HTML meta element that is implemented in the source code of the page, 301s can be solved via the server.

In addition, a canonical tag does not actively redirect the URL to the canonical URL. Rather, it is an indication to search engines that an “original” URL exists which the existing document refers to, or of which the existing document is a copy.

Ideally, search engines then ignore the duplicates and index only the canonical URL. However, a canonical tag is only a recommendation, and the Googlebot does not necessarily have to obey that recommendation.

A 301, on the other hand, is a clear guideline that the server or client must follow. Even with a 301 redirect, the original URL can still be indexed. However, after some time it will be replaced in the index by the new target URL.

In general, 301s are the better solution when it comes to clean consolidation or redirection of URLs, and when there are no reasons to believe that content can be accessed via different URLs.

302 redirect: “moved temporarily”

With this method, you show a client that the requested document is temporarily accessible via another URL. Like all 3xx-redirects, the 302 passes on PageRank and relevant SEO signals to the destination URL.

A 302 is recommended if you need a temporary redirect that has no effect on your rankings and should not be cached.

For example, you can use a 302 if you want to redirect a URL to a promotional page or a product page with seasonal merchandise. This method is also suitable for tracking or website testing.

How do I set up a 302 redirect?

To set up a 302, you can use the .htaccess file, as with 301 redirect.

The entry for a temporary .htaccess redirect can look like this, for example:

RewriteEngine On
RewriteBase /
RewriteRule pageold.html pagenew.html [R=302]

A 302 redirect is always temporary. This is why you should not use them for permanent URL redirects.

Afterwards, you can easily check if it worked with a Ryte Free account.

307 redirect: “moved temporarily”

You can use this method if a URL has to be redirected only for a short time. This can be the case e.g. for server maintenance. Like 302s, this method should not be used for permanent redirects.

JavaScript redirects

This form of client-side URL redirects requires clients that can handle JavaScript. They are mainly used for redirects that are based on user input or that refer to redirects between different browsers. Furthermore, these redirects can also be used to immediately adapt the target page to the respective output device.

As with all client-side redirects, a major disadvantage with JavaScript is its dependence on the respective client. If the client cannot interpret JavaScript, this method will not work. For this reason, you should always consider server-side redirects first.

Here is how it should look when you insert a JavaScript redirect to the source code of the page as a script.

<script type="text/javascript">
<!--
window.location = "http://www.newpage.com/";
//–>
</script>

In this case, the user is redirected to “newpage.com” when the existing URL is opened. If you want to read more about JavaScript redirects, you can find more input here.

Google’s address change tool

If you’ve redirected your domain or subdomain from one to another, you can tell Google using the Change of Address Tool.

This will notify Google of the change and help you move your search results from your old website or subdomains to the new one. To use this tool, you must have a Google Search Console account for the domain.

Note that you can only use this tool to monitor the redirected traffic if it is a domain change. Read more about it here.

Common redirect errors

There are a few potential problems to be aware of when getting started with URL redirects. Here are the most common ones:

Redirect chains

If you use redirects, especially 301 redirects, you should avoid redirect chains. Such chains occur when a URL is redirected to another URL where a redirect is already implemented. In extreme cases, the browser or bot can no longer resolve the original request and displays a warning of “too many redirects.”

At the same time, multiple redirects increase loading time and server load. Further negative consequences of redirect chains are the waste of crawl budget and SEO potential. John Mueller (formerly of Google) has confirmed this in response to a request from seoundtable.com 2016 that webmasters should avoid and fix redirect chains, especially when moving domains.

When migrating a domain, it’s best to get an overview of all redirect chains beforehand to avoid future redirect chains. Get an overview of all of your redirects with a Ryte Free account.

Wasting crawl budget

Search engines continuously crawl the web for new content. The bots follow links, crawl websites, and index content and other elements. However, only a limited amount of crawl budget is available for this process, but thankfully, SEOs and webmasters can influence how the Googlebot uses crawl budget. One such way is through changing the number of requests the bot sends to the server.

If a URL is redirected, the Googlebot must execute an additional request. If there are a lot of redirects on a web page, the number of requests will also increase, but the crawl budget will be reduced. Therefore, you should generally use redirects sparingly. If the crawl budget is exhausted faster by redirects, the Googlebot has less time to crawl and index more pages, meaning your indexed pages are no longer up to date.

Losing organic traffic

In general, every redirect bears the risk of traffic loss. Google no longer punishes websites with a dip in PageRank if they are forwarded with a 301 redirect, but incorrectly implemented or superfluous redirects can be bad for a website.

This is especially the case if you redirect URLs to irrelevant pages with the intention of deliberately bring traffic to a sales page that has nothing to do with the redirected page. For example, a redirect from a traffic-heavy info page on sunglasses, to a pure affiliate page via 301. A 2016 study proved that Google interprets irrelevant redirects as soft 404 errors.

In fact, link equity (or “link juice”) is only one of many ranking factors that are passed on during a redirect. For example, if the titles on the new target page are not maintained or the content is of inferior quality, a redirect can also have negative consequences for rankings.

How to check your redirects

If you want to analyze all redirects on your website, Ryte can help you. You can check whether your configured redirects are functioning and whether the .htaccess is correctly programmed.

You can discover whether there are syntax errors or whether you have loaded the file in the correct directory. You will also learn whether the rules on file relate to the desired directory and whether the correct type of redirecting is given.

Under Quality Assurance, click on “Redirect Status Codes”. Here, you have a clear overview of your redirects. To see a list of each different type of redirect, click on the respective box:

Screenshot-2022-01-19-at-14.56.29 url redirects StoryblokMigration Status Code redirects redirect http status code Duplicate Content Canonical Tag 308 redirect 307 redirect 303 redirect 302 redirect 301 redirect

If you click on the report “Target Categorization” in the report, you can see the following information:

  • To which website your original URLs redirected

  • Whether your redirecting forwards to a different directory or subdomain

Screenshot-2022-01-19-at-14.56.53 url redirects StoryblokMigration Status Code redirects redirect http status code Duplicate Content Canonical Tag 308 redirect 307 redirect 303 redirect 302 redirect 301 redirect

Wrapping up redirects

If you use URL redirects correctly, you can fix SEO problems and redirect old domains to new ones safely and without major disadvantages.

Reflect on each redirect and make sure it really makes sense. Use 301 redirects with care, making sure not to increase the latency of the server unnecessarily or to not use Googlebot’s crawl budget unnecessarily.

Ryte users gain +93% clicks after 1 year. Learn how!

Published on Dec 10, 2021 by Editorial Team