Redirects in short

A redirect is a way to forward visitors and search engines from one URL to another. This is useful when moving content to a new URL, when deleting pages or when changing domain names or merging websites.

Whenever possible avoid using redirects, but when you have to use them, make sure to follow these best practices:

  • Avoid chained redirects: one redirect should not forward to another redirect.
  • Redirect to the preferred version of your website, using the right protocol (http or https), domain name (www or non-www) and path notation (with or without trailing slash).
  • Use a 302-redirect for inactive campaigns.
  • Use a 301-redirect for content that’s permanently removed.

What are redirects?

Redirects are a way to forward visitors and search engines to a different URL than the URL they requested. Redirects play an import role within the SEO field, so it’s important to know what types of redirects there are, when to use which ones and how they measure up against one another.

Why should you use redirects?

Redirects are important for both visitors and search engines when content has moved:

  • Visitors: you want to offer visitors a great user experience on your website. When they’re requesting content that was previously available on URL A, you don’t want them to hit a 404-page. You want them to be redirected to an alternative URL.
  • Search engines: you want search engines to understand that content has moved. Doing so enables you to communicate how you want them to crawl and index your website. This is important for your SEO performance.

To illustrate those points, say you have a temporary summer sale campaign for flip flops. When people request the flip flop category page at https://www.domain.com/flip-flops/, you want them to be redirected to https://www.domain.com/flip-flop-summer-sale/ which has a different design and contains the limited offer. https://www.domain.com/flip-flop-summer-sale/ will be removed again after 2 weeks and then https://www.domain.com/flip-flops/ is back in play. In this case, you want search engines to remember https://www.domain.com/flip-flops/ and to keep it in the index because the redirect was only temporary in nature. In this case you’d use a 302 redirect.

Other situations in which to use redirects:

  • Deleting pages: when pages are deleted, it’s important to 301 redirect the URLs of the deleted pages to an alternative page.
  • Changing domain names: if you move your website over to a new domain name, you need to let redirect both visitors and search engines to the new domain name. Visitors have a good user experience, and search engines understand that you’ve moved over to the new domain name and will attribute the old domain name’s accumulated value to the new domain name.
  • Merging websites: merging websites is actually a form of changing domain names, it involves one or more domain names that are merged into. This is common after acquisitions, or when satellite websites cease to exist.

What types of redirects are there?

Redirects can be divided into server-side redirects and client-side redirects. Both types of redirects can be implemented in various ways. Be very careful about your choice for the type of redirect: choosing the wrong redirect for the job could lead to SEO troubles.

Server-side redirects

A server-side redirect is a forwarding method in which the server sends a 3xx HTTP status code when a URL is requested. The server determines what URL visitors and search engines should be sent to.

The most common HTTP status codes are:

301 redirect: Moved permanently

What is a 301 redirect?

A 301 redirect is a server-side redirect which redirects users from URL A to URL B, while signaling to search engines that URL A’s content has been permanently moved to URL B.

When it comes to redirects, the 301 redirect usually is your best choice. It’s worth noting that browsers will often cache 301 redirects because of their permanent nature, so keep that in mind when dealing with redirects.

The role of the 301 redirect in SEO

The general consensus is that a 301 redirect passes 90-95% of the page authority from an old URL to a new URL. While a visitor won’t notice the difference between a 301 redirect and a 302 redirect, for a search engine this is a completely different signal.

Be careful about using 301 redirects when redirecting isn’t permanent. If you intent to remove the 301 redirect shortly after implementing it: be prepared to wait several weeks, if not months to see the redirected URL back in the search engines’ indices.

302 redirect: Found (HTTP 1.1) / Moved temporarily (HTTP 1.0)

What is a 302 redirect?

A 302 redirect is a server-side redirect which redirects users from URL A to URL B, while signaling to search engines that URL A’s content has been temporarily moved to URL B.

The role of the 302 redirect in SEO

A 302 redirect passes no page authority from the old URL to a new URL. A 302 redirect is rarely used since in most cases you want to pass a page’s authority and only a 301 redirect will let you do that.

SEO specialists have conducted research what happened if a 302 redirect is in place for a long time, let’s say longer than 6 months. They saw that over time, search engines started to regard the 302 redirect as a 301 redirect due to its permanent nature.

Situations in which to use 302 redirects:

  • When a URL is temporarily moved to another URL;
  • When you have a desktop and mobile website, and you want to redirect desktop visitors that come to the mobile website, and vice versa.

303 redirect: See Other

What is a 303 redirect?

A 303 redirect is a server-side redirect that ensures visitors won’t be able to re-submit forms when using the back-button in her browser, because the 303 redirect indicates that the follow-up request to the temporary URL should be made using the GET HTTP method. 303 redirects should only be used for handling form submissions on websites.

The role of the 303 redirect in SEO

The 303 redirect doesn’t play a role in SEO, as search engines don’t perform POST request. Don’t use the 303 redirect when you need to redirect URLs after content has moved, it’s not what it’s intended for.

307 redirect: Temporarily Redirect

What is a 307 redirect?

A 307 redirect is a server-side redirect that is the HTTP 1.1 equivalent of the 302 redirect. The 307 redirect was brought to life to make sure the HTTP method used to do a request doesn’t change when the server responds with a 307 redirect. If HTTP method GET was used, the GET is passed on as part of the redirect. If POST was used, then a POST is passed on as part of the redirect.

The role of the 307 redirect in SEO

Similar to the usage of 302 redirects, a 307 redirect should only be used when content has been temporarily moved to another URL. At the moment, it’s still unclear how search engines handle the 307 redirect to we recommend using the 302 redirect to indicate that content has temporarily moved.

Pro-tip: 307 is also used as an internal redirect in case of HSTS

HTTP Strict Transport Security, HSTS for short, is a way for web servers to declare that web browsers should interact with it using only secure HTTPS connections, and never via the insecure HTTP protocol. That sounds complicated, but conceptually it’s not. Let’s take an example:

When your browser knows that a website is using HSTS (because it was told so when previously visiting the website), it will force you to only access the HTTPS version of the website by internally redirecting any HTTP URL to HTTPS whenever you try to visit the HTTP version.

The browser will use a 307 to internally redirect from HTTP to HTTPS. So while the 307 redirect is a server-side redirect, it can be used as an internal redirect too within a browser. In reality, it’s not a “real redirect” search engines will encounter so don’t think you’re safe from harm when you see the 307 redirect: it could be an internal redirect. Read more about this on Troy Hunt’s website.

308 redirect: Permanent Redirect

The 308 redirect is the permanent version of the 307 redirect. As can be expected with a permanent redirect, the 308 redirect does pass page authority.

Similar to the 307 redirect, the 308 redirect keeps the originally used HTTP method. At the moment, it’s still unclear how search engines handle the 308 redirect to we recommend using the 301 redirect to indicate that content has permanently moved.

Client-side redirects

A client-side redirect is a forwarding method in which a visitor’s browser handles redirection. Using client-side redirects has several drawbacks, namely:

  • SEO: search engines will not pass authority from one page to another when client-side redirects are used because they may not be aware of the redirects. If you want to make sure search engines are able to pick up on redirects, make sure to use server-side redirects. If you want to make sure authority it passed on use a 301 redirect.
  • Back button: client-side redirects break the back button. When trying to use the back button, visitors will immediately be sent to the URL they were redirected to.
  • Support: not all browsers support client-side redirects.

Due to these reasons we strongly recommend not to use client-side redirects.

Because of the nature of this article, it is important to describe the client-side redirects:

Meta refresh redirect

The meta refresh redirect is implemented using the meta refresh-element, located in the <head>-section. It’s used to instruct a browser to refresh a page or load another URL after a certain amount of seconds.

An example of what the meta refresh redirect looks like to send a visitor to http://domain.com/other-url/ after loading the page:

<meta http-equiv=”refresh” content=”0; url=http://domain.com/other-url/”>

JavaScript redirect

The JavaScript redirect is used to instruct a browser to load another URL. An example of what a JavaScript redirect may look like:

<script>location.href=’http://www.example.com/’;</script>

What are the best practices for redirection?

When using redirects, keep the best practices below in mind to make sure you offer your visitors an optimal user experience and you preserve as much page authority as you can.

Avoid redirects whenever you can

Yes, you read it correctly: avoid using redirects whenever you can. They slow down load time and waste crawl budget.

Are redirects hurting your SEO?

Redirects may be holding back your SEO performance.
Check your website for excessive redirects right away!

Please enter a valid domain name (www.example.com).

Please note that it’s totally fine to use 301 redirects for configuring your webserver so it serves URLs according your preferences.

Avoid chained redirects

When using redirects, be vigilant for chained redirects. A chained redirect is when one URL is requested, a redirect is used to redirect it to another URL and in turn this particular URL is redirected as well. Since not all page authority is passed in a redirect, having a chained redirect with one or more extra hops is surely not improving the amount of passed page authority.

Example: let’s assume URL A redirects to URL B, URL B to URL C and URL C in turn redirects to URL D. Now, let’s say you lose 10% of the authority in a redirect then the authority arriving at URL D is: 0,9 x 0,9 x 0,9 = 0,729.

Redirect to preferred version of your website URL

It’s important to choose a preferred version of your website URL and stick with it. Below we describe two important topics you need to think about when linking. Consistently using the preferred version of your website URL prevents unnecessary redirects which cause loss of page authority.

To www or not to www

For example: if you prefer to have your website on the www subdomain make sure requests for URLs without the www subdomain are 301 redirected to the version with the www subdomain. Remember: for search engines www.example.com and example.com are two separate domains.

HTTPS or not

If you’re using HTTPS then make sure the HTTP variants of URLs are 301 redirected to their HTTPS counterparts.

To slash or not to slash

Choose your preference when it comes to trailing slashes as well. For search engines www.example.com/page-a and www.example.com/page-a/ are different URLs. When both URLs serve the same page, and no canonical URL or meta name=”robots” content=”noindex” is used, then this causes you to have duplicate content. If you prefer the trailing slash: make sure requests to the version of the page without the trailing slash are redirected to the version with the trailing slash.

Getting links to the preferred version your website URL

People will link to your website the way they want to. Often they do not adhere to your preferred version of your website URL. They may link to your contact page with the URL http://yourdomain.com/contact while your URL in reality lives on http://www.yourdomain.com/contact/. When you’ve correctly configured your webserver visitors will end up on the right URL, but you’ll lose a bit of authority in the redirect. Monitor your inbound links with a tool such as Majestic and reach out to the ones linking to the wrong version of your URLs.

Use 302 redirect for inactive campaign URLs

Tons of websites employ campaign URLs to support their online and offline campaigns. After such a campaign, these URLs are often just 301 redirected but that’s often incorrect because these campaigns may return one month later.

When a campaign is simply temporarily inactive and will return in the future: use a 302 redirect to be able to keep the campaign URL in the search engine indexes when you need it again.

Use 301 redirect for campaign URLs that will never again be used

When you’re absolutely sure a campaign URL will never be used anymore, it’s safe to 301 redirect the URL to the most relevant URL within your website. If there’s any doubt about it, use a 302- redirect so you basically have the URL on standby. The URL will remain in the index and the URL can be used to rank again in the search engines.

Clean up redirects

Having (hundreds of) thousands of redirects may, depending on the way the redirects are implemented, slow a website down significantly. On top of that, sometimes old redirects play a vital role in strange website behavior. An old redirect could be causing inexplicable behaviour within your website. Keep things simple, keep the amount of redirects within your website to a minimum. Periodically check which redirects are necessary and which redirects can be cleaned up. Only URLs that have inbound links and/or get serious referral traffic should be redirected. These URLs can be found by analyzing the inbound links to pages on your website using services such as Majestic and Ahrefs combined with referral data from your web analytics service. All URLs that redirect but have no inbound links and referring traffic can be removed.

IP canonicalization

IP canonicalization is the process of implementing redirects for an IP-address to a domainname. This is done to prevent duplicate content.

If your webserver is incorrectly set up it may serve your website both for your webserver’s IP address and your domain name. Aside from the strange user experience, having your website accessible to search engines both through your IP address and domain name leads to duplicate content and should be avoided. Good news, a solution to this problem is not that hard. If you’re using Apache webserver, this can be fixed by including the code below in your .htaccess file.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^123.123.123.123
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Note: replace 123.123.123.123 with your server IP address, and example.com with your domain name.

How to set up redirects?

Traditionally URL redirects had to be configured on the web server level. Nowadays most common Content Management Systems offer at least basic support for configuring URL redirects.

Setting up URL redirects in a CMS has the benefit that it’s much more accessible for people without a development or system administration background but it comes at a cost. When there are problems with the CMS the redirects might stop working and in most cases the redirects will be slower, as the CMS needs to be loaded for every redirect. On top of that, redirects set up within the CMS and on webserver level can co-exist leading to confusion and possible mistakes.

Therefore it’s always advisable to set up URL redirects on the webservers, and only use CMS redirects when there is no other way to do so.

Make setting up redirects easier using regular expressions

Regular expressions is a language which can be used to search within text using patterns. For example, to search in a string of text for digits the regex [0-9] can be used. Another example is using regex to match optional characters. filename.html? matches both filename.htm and filename.html.

Regular expressions are extremely useful for setting up redirects, as it saves you the hassle of setting up redirects for individual URLs. For example, let’s say you have the following URL-structure:

  • /blog/category-1/
  • /blog/category-2/
  • /blog/category-3/

then instead of setting up three different redirect rules you can use the following regular expression to match all these subdirectories: /blog/(.*)/.

Setting up URL redirects in the Apache webserver

When you are using the Apache webserver you need to use the RewriteEngine which is part of the modrewrite-module. This module is usually loaded by default in Apache, but if not make sure that you load it specifically in your Apache configuration using the following directive:

RewriteEngine On

When the module is loaded you can set up redirects using the following formatting:

RedirectMatch 301 /blog/(.*)/ /news/$1/

This will instruct Apache to redirect all subdirectories of /blog/ (the categories) to the new location in /news/.

Redirecting Canonical Hostnames

Another common use-case of redirecting URLs is to ensure that all URLs include the ‘www’-part of your domain name. In that case you can set up a rewrite rule that only runs when a certain condition (the URL not containing the ‘www’-part of the domain name) is met.

RewriteCond %{HTTP_HOST} *!^www*.example.com [NC]
RewriteRule (.*) http://www.example.org/$1 [L,R=301]

This rewrite rule redirects all URLs to the version that includes the ‘www’-part, but only if that part is actually missing (the rewrite condition).

Frequently asked questions about redirects

  1. 301 redirect vs. 302 redirect: which one is better?
  2. How much authority is passed on with a 301 redirect?
  3. 302 redirect vs. 307 redirect: which one is better?

1. 301 redirect vs. 302 redirect: which one is better?

It depends on the situation:

  • Did your content permanently move? Use a 301 redirect.
  • Did your content temporarily move? Use a 302 redirect.

2. How much authority is passed on with a 301 redirect?

The general consensus is that a 301 redirect passes 90-95% of the page authority from an old URL to a new URL.

2. 302 redirect vs. 307 redirect: which one is better?

While these redirects are both meant for situations in which content has been temporarily moved, it’s unclear how search engines handle the 307 redirect.

Therefor, it’s better to use the 302 redirect for temporary redirects.

Start your free 14-day trial

Get up and running in 20 seconds

Please enter a valid domain name (www.example.com).
  • No credit card required
  • No installation needed
  • No strings attached