How to Properly Use Redirects on Your Website
Redirects are an indispensable technique that can be helpful in many different SEO use cases. But you have to understand how to use them rightly. Start using redirects on your website by learning the right way to use them for SEO.
What is a URL redirect?
A redirect is a technique used to forward or "redirect" a URL requested by a client (browser) to another URL. A redirect is completed when the client successfully reaches the target URL of the redirect. Redirects can be implemented in different ways and can be either temporary or permanent.
When is it useful to use redirects?
There are many different use cases for redirects. For example, one of the most common use cases is a domain migration/domain transfer, in which case Google itself explicitly recommends 301 redirects and has established its own guidelines.
Other 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 other obsolete. If redirects aren't set up, the server will return a 404 error code when retrieving the old URLs. Redirects ensure that traffic and link juice are forwarded to the new URLs and that usability is preserved.
- 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" to avoid duplicate content.
What types of URL redirects are there?
In general, there are server-side and client-side redirects. The most common server-side redirects are 301 and 302 redirects. The most commonly used client-side redirect is the meta refresh redirect.
What are server-side redirects?
A server-side redirect occurs when a HTTP request is made. This happens when a client, i.e. 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 redirect, the server indicates that the requested document has been redirected to another URL. The client then accesses this new URL and the user or bot is redirected to it.
Servers can deliver different status codes according to the RFC 7231 specification. Each of the redirects fulfills a separate task. The entire process of a server-side redirect takes only a fraction of a second and, depending on the type of redirect, goes relatively unnoticed. Search engines have to interpret each redirect and decide how to handle it. For SEOs and webmasters, there is always the question of whether the desired redirect can pass on link juice and ranking signals when using server-side redirects.
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.
Server side SEO redirects:
|HTTP Status Code||Temporary or Permanent|
What are client-side redirects?
Client-side redirects 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.
301 Redirect:"Moved Permanently"
In terms of SEO, 301 redirects are very important. This redirect transfers link juice and all relevant ranking signals to the new target URL.
A 301 redirect is a useful solution to prevent orphan pages or to bundle incoming links. You should use a 301 redirect 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 redirect is intended to permanently redirect URLs. This redirect is not a suitable solution for temporary activations like seasonal products in your online store or redirects to a short-lived promotional page.
How long should 301 redirects remain active?
There is no one-size-fits-all answer. Even 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 redirects 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 redirect?
301 redirects can be implemented via the .htaccess file of an Apache server or with PHP.
1. .htaccess redirect: This file is a set of instructions for the server to execute when an http-request occurs. To implement a 301 redirect you need the Apache module "mod rewrite." The file specifies the URL to which the client should be redirected.
A .htaccess redirect can look like this:
RewriteRule pageold.html pagenew.html [R=301]
In this case pageold should be redirected to pagenew.
2. PHP redirect: You can also set up a redirect via PHP. For this purpose, a code snippet is inserted in the header of the HTML document. If the client requests the page, the user is redirected to the new URL. This redirect is not a server-side redirect. Nevertheless, it's listed here for the sake of completeness!
URL redirects for duplicate content: Canonical tag or redirect?
There are two common technical options available to avoid duplicate content: the canonical tag and the 301 redirect. While the canonical tag is an HTML meta element that is implemented in the source code of the page, 301 redirects 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 heed that recommendation.
A 301 redirect, 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 of the redirect.
In general, 301 redirects 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: “Found” / “Moved Temporarily”
With this redirect, you show a client that the requested document is temporarily accessible via another URL. Like all 3xx-redirects, the 302 redirect passes on PageRank or relevant SEO signals to the destination URL.
A 302 redirect 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 redirect if you want to redirect a URL to a promotional page or a product page with seasonal merchandise. This redirect is also suitable for tracking or website testing.
How do I set up a 302 redirect?
To set up a 302 redirect, you can use the .htaccess file or use PHP, as with 301 redirect.
The entry for a temporary .htaccess redirect can look like this, for example:
RewriteRule pageold.html pagenew.html [R=302]
A 302 redirect is always temporary. This is why you should not use these redirects for permanent URL redirects.
307 Redirect: “Moved Temporarily”
You can use this temporary redirect if a URL has to be redirected only for a short time. This can be the case e.g. for server maintenance. Like the 302 redirect, this redirect should not be used for permanent redirects.
window.location = "http://www.newpage.com/";
In this case, the user is redirected to "newpage.com" when the existing URL is opened. If you want to read more about
Can redirects pass on PageRank?
For a long time, 301 redirects were associated with a loss of PageRank or link juice. But today, there are numerous statements from Google employees that show that redirects pass on PageRank.
- In February 2016, John Mueller made a hangout on the subject and announced that there is no PageRank loss for 301 or 302 redirects from http to https.
- Gary Illyes also made two statements on the topic "redirects and PageRank." In a blog post, he confirmed that PageRank is passed on regardless of the redirect used (301, 302, or 307). He confirmed this statement again in July 2016 on Twitter: "30x redirects don't lose PageRank anymore.
Even if this seems to confirm that redirects pass on PageRank, webmasters also need to consider other SEO factors that may be impacted when redirecting to new URLs.
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.
Which redirect is best for different situations?
|Use Case||Temporary or Permanent||Cacheable||Possible Status Codes|
|Changes to the URL structure||permanent||yes||301|
|Geo targeting||temporary||no||302, 307|
|Affiliate campaign||temporary||depends on the intent||302|
Common SEO errors with redirects: 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 of Google has confirmed this in response to a request from seorundtable in 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.
What impact do redirects have on 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, Webmasters can influence how the Googlebot uses crawl budget. One such way is through 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.
Can I lose traffic from URL redirects?
In general, every redirect bears the risk of traffic loss. Google no longer punishes websites with a dip in link juice if they are forwarded with a 301 redirect, but incorrectly implemented or superfluous redirects can be disadvantageous 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, let’s say sunglasses, to a pure affiliate page via 301. A 2016 study proved that Google interprets irrelevant redirects as soft 404 errors.
In fact, link juice is only one of many ranking factors that are passed on during a redirect. If, for example, 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.
Closing thoughts on URL 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.