Redirects: What They Are, How to Use Them, and Best Practices

Kelly Lyons

Nov 07, 202216 min read
Contributors: Carlos Silva and Zach Paruch
redirects guide

TABLE OF CONTENTS

What Is a Redirect?

A redirect is a way to send users and search engines to a different URL from the one they requested.

This is commonly used when a webpage is moved to a new address, ensuring that visitors and search engine crawlers are automatically taken to the correct page.

Common redirects include 301 (moved permanently), 302 (moved temporarily), and meta refresh. We’ll get into those later. 

Why Are Redirects Important?

Redirects are important because they:

  • Forward traffic from one URL to another when the old URL no longer exists
  • Forward authority when backlinks point to a page that has been moved
  • Improve the overall user experience by ensuring visitors don’t land on broken or duplicated pages

If you forget to implement redirects, you can lose search engine rankings and end up with unhappy users. 

Here’s an example: 

Say you move or delete a page but don’t put a redirect in place. Users will receive a 404 error response from the server.

Like this:

Upflex 404 page example

That’s not good for user experience. A 404 might cause visitors to leave your site.

Proper redirects prevent these types of errors. And help users find the pages they’re looking for. 

Plus, what if you have backlinks pointing to the page you deleted (and is now triggering a 404 error)? 

Big problem: 

You’ll lose all authority from those backlinks. That’s confirmed by Google Search Advocate John Mueller: 

When to Use Redirects

Here’s a list of common reasons for URL redirections:

  • You move the URL of a webpage (from URL A to URL B)
  • You delete a page
  • You add category tags or parent pages that affect URLs
  • You move your website to a new domain
  • You’re performing maintenance on a webpage
  • You merge two or more duplicate webpages
  • You migrate your site from HTTP to HTTPS

You can apply a redirect to a single URL. Or to a group of URLs. You can also redirect an entire domain to another domain name.

You may need to use a different type of redirect depending on your situation. 

Let’s cover the most common redirect types and when to use them.

Redirect Types

There are two main types of redirects: permanent and temporary

Users won’t be able to tell the difference. But they’re important for search engines. 

Here’s why:

Permanent redirects are for when you don’t expect to display the old page again. Like if you delete a page. Or if you combine duplicate pages. 

They tell search engines it’s OK to remove the old URL from search results and start displaying the new one.

Temporary redirects are for when you need to redirect a page for a short time. 

For example: 

Say you’re performing website maintenance. You could temporarily redirect users to a message telling them to check back after maintenance is complete. 

HTTP Redirects

HTTP redirects use a special code in the HTTP response to tell the browser to go to a different web page. 

Here’s how it works: 

The user’s browser requests the old (redirected) URL. The server automatically displays the webpage for the new URL (the redirect target).

From the user’s point of view, HTTP redirects are completely seamless.

In technical terms, these are called server-side redirects. Because your web server (where your website is hosted) takes care of it before your website even loads.

It does that by responding with a 3xx HTTP code when it receives the request for the redirected URL.

Those 3xx codes are like instructions for your browser. They indicate that the requested URL has been redirected. And where to find the new webpage (the redirect target).

Here are the most common types of 3xx codes (and what they mean when a server sends them):

  • 301: Moved permanently 
  • 302: Redirected temporarily
  • 303: Redirected temporarily
  • 307: Redirected temporarily
  • 308: Redirected permanently

301 Redirects (Moved Permanently)

301 redirects signal to Google that the redirect from one URL to another URL is permanent. 

And they’re also considered the best way to pass link equity if you need to redirect a page. That’s because they pass page authority from the old URL to the new URL.

Let’s get into a real-life example of how 301s work.

Say your site has two pages about dog toys. There’s no need for two pages about the same topic. Plus, one of the pages is outdated.

301 redirect example page

In this case, it’d be best to delete the older, outdated page and 301 redirect its URL to the new page’s URL.

Further reading: 301 Redirect: What It Is & How It Impacts SEO

302 Redirects (Found & Moved Temporarily)

302 redirects tell Google that the redirect from one URL to another is temporary. 

Use a 302 redirect when:

  • You temporarily move your page to a new URL
  • A page is under maintenance
  • When you want to A/B test new website design or copy

Google will continue to index the redirected page, and no link juice or traffic is passed on to the new page.

Which means:

Using temporary redirects by mistake could damage your search engine rankings. 

Check for issues by running a quick site audit with Site Audit

Head to the “Issues” tab and type “redirect” into the search bar. You’ll see the number of URLs with temporary redirects. 

Results for "redirect" under the "Issues” tab in Site Audit

Not sure when to use a 302 instead of a 301?

In general, only use a 302 if you plan to bring back the original URL at some point (or set up a new one).

Further reading: What’s a 302 Redirect? And When Should You Use It?

Other HTTP Redirects

As far as server-side redirects go, you’ll only need to use a 301 or 302 in most cases. 

But there are other types of HTTP redirects. These are much more rare. But they can still be good to know in certain situations:

  • 303 redirect (see other): Sends users to another relevant page when the old one is not available (most often when users have already submitted a form and cannot resubmit) 
  • 307 redirect (moved temporarily): Similar to a 302 redirect, but directs server requests for the webpage differently (302s are generally considered to be better for SEO)
  • 308 redirect (moved permanently): Indicates a permanent move and is treated the same as a 301 (though it can make reporting confusing if you randomly switch between the two)

Meta Refresh Redirects

Meta refreshes are redirects that happen at the page level (client-side) rather than the server level. That means they happen in your browser rather than on a server. Unlike HTTP redirects.

Here’s the thing:

If you have to do a redirect, HTTP redirects are better than meta refreshes for SEO. 

Why?

Meta refreshes can confuse Google and website visitors. They’re slower (hurting user experience). And they might lead to Google indexing the wrong page.

But Google only recommends meta refresh redirects if youcan’t use a server-side redirect. This is because they’re slower and don’t pass as much link equity.

There are two types of meta refresh redirects: instant and delayed. 

Instant meta refresh redirects trigger as soon as the browser loads the page. Google interprets these as permanent redirects.

They look like this:

<meta http-equiv="refresh" content="0; url=https://www.semrush.com/">

Delayed meta refresh redirects trigger after a number of seconds you choose. Google interprets these as temporary redirects.

Here’s an example that triggers after five seconds:

<meta http-equiv="refresh" content="5; url=https://www.semrush.com/">

JavaScript Redirects

JavaScript redirects use the programming language JavaScript to send users from one URL to another. They also happen on the client side rather than the server side.

And like meta refresh redirects, they aren’t recommended for SEO. This is because Google may not index your pages correctly when redirecting using JavaScript.

Which could hurt your website’s rankings in search results.

Google treats JavaScript redirects similarly to 301s. But it’s not guaranteed—so you may be pushing your luck with page authority if you go with this type of redirect.

Here’s an example of a JavaScript redirect in your HTML code:

window.location.replace("https://example.com");

Further reading:

How to Implement Redirects

There are three main ways to set up HTTP redirects: 

  • Through plugins
  • Through your CMS (content management system)
  • Through an .htaccess file

Use WordPress Plugins 

If you use WordPress, you can set up redirects with plugins.

We’ll use Yoast for this example because it’s one of the more common WordPress SEO plugins. But there are many similar 100% free options.

To start the process, first download the plugin from the WordPress store. 

Then, head to the “Plugin” page on WordPress and click “Activate.”

Activate Yoast SEO plugin

The plugin is now active.

Next, select Redirects under the Yoast menu of the left-hand toolbar (the “SEO” with a “Y” next to it):

Yoast SEO in WordPress toolbar

And choose the type of redirect you want to set up.

choose redirect type

Enter the slug (the part of the URL after “.com”) of the old URL you wish to redirect and the new URL you wish to redirect to. 

Make sure the slug is spelled correctly. Otherwise, the redirect won’t work.

Add redirect in Yoast

Click Add Redirect and your redirect will be live.

You’ll find a full list of live redirects below the Add Redirect button.

Live redirects

Further reading: How to Redirect URLs on WordPress

Use Wix

If you use Wix, you can set up redirects directly in the CMS.

Scroll down to the bottom of your website control panel. Click on “SEO Tools” under “Marketing & SEO.”

Wix SEO tools

Click URL Redirect Manager at the bottom left corner of the tools list.

URL redirect manager in Wix

Then, hit the “New Redirect” button at the top right corner of your screen.

A pop-up will appear. Select your type of redirect and add the old URL you wish to redirect from.

Save your redirect in Wix

Finish by clicking Save or Save & Add Another.”

Use an .htaccess File

You can also perform redirects manually.

Warning: This option is only for experts. If you make a mistake, it can cause big problems for your website.

You can set up redirects with a file called .htaccess. It’s in plain text and looks like this:

.htaccess file example

Apache servers use the .htaccess file. (But these can be found on other types of servers, too). 

Start by locating the RewriteEngine (which can be found in the mod_rewrite module in Apache).

This module should already be in Apache by default. But if it’s not being loaded, you can add it using this code:

<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>

Now, we’ll add our rules directly below “RewriteEngine On.”

Redirect a Single URL

To redirect one URL, use the code below. Specify the type of redirect and replace /oldpage/ and /newpage/ with the actual slugs of your pages.

Redirect 301 /oldpage/ https://www.example.com/newpage/

Redirect a Single Folder

To redirect a folder, use the following code and replace “folder” with the folder you’d like to redirect and “location” with where you’d like to redirect the folder.

RewriteRule ^folder/(.*)$ /location/$1 [R=301,NC,L]

Redirect to Another Domain

To redirect to a new domain, add the following code:

RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

Redirect Non-www to www

If users (or search engines) try to reach URLs without the “www” subdomain, you can redirect them to the URL that does include it.

There’s not a huge practical difference between the two. But Google views www and non-www versions of the same URL as different entities. 

So choosing one “correct” subdomain helps Google understand which one is “official.”

Add this code to redirect a non-www URL to a www URL:

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

Redirect www to Non-www

This is essentially the opposite of the above. If you don’t want users to access the “www” subdomain, you can add this code:

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

Non-www URLs can be useful for direct traffic, as people usually enter in URLs without the “www.” However, keep in mind that you have less control over cookies with the non-www subdomain.

Redirect HTTP to HTTPS

If you’re looking to redirect HTTP pages to HTTPS, here’s the code you’ll need:

RewriteCond %{https} off
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

Keep in mind that you’ll need to purchase an SSL certificate before redirecting to HTTPS, though. 

Further reading: How to Redirect HTTP to HTTPS (+ Best Practices)

5 Redirect Best Practices

Now that we've covered how to redirect pages, let's go over some of the most important best practices to follow.

1. Always Redirect to Close Match Content

When you set up a redirect, make sure the new page’s content is a close match to the old page’s.

For example, redirecting an expired specials page to your main specials page instead of your homepage makes a lot more sense.

If your redirect links to an old URL that isn’t relevant, search engines may not pass on the authority of the old page. 

This is not good for user experience. And can result in a soft 404.

A soft 404 happens when the server sends a “200 OK” HTTP status, but Google thinks the page should 404. (200 status codes mean the request was successful according to the server.)

This can happen if your page has no content (like an empty product category or blog category page), if your page seems unrelated to the redirected page, or if the page displays a 404 message (but still sends to 200 HTTP status).

Google essentially skips over true 404 pages. This doesn’t happen with soft 404 errors, so it’s best to avoid them and fix any existing errors.

You can find soft 404s with Google Search Console.

Head over to the “Coverage” tab under “Index.”

Google Search Console Coverage report

Search Console marks soft 404s as errors.

It will give you a list of URLs that appear to be soft 404s in the “Errors” section underneath the graph.

Google Search Console 404 error

Once you find the soft 404 errors, fix them. 

For any soft 404 related to redirects, update the redirect so that it points to the most relevant page available.

2. Avoid Redirect Chains & Loops

A redirect chain is when more than one URL redirect exists between the original URL and the final URL.

Let’s say that a page’s URL was previously www.yoursite.com/about-the-company/ (URL A) before it was redirected to www.yoursite.com/about-us/ (URL B). 

If you later redirect the newer URL to www.yoursite.com/about/ (URL C), that would create a redirect chain.

Because now the first URL redirects to the second URL. And the second URL redirects to the third URL.

Like this:

redirect-chain

Google can follow up to 10 redirect “hops” without issues. But be careful of making things too complex.

Redirect chains that are too long can delay crawling, cause losses in link equity, and increase page load time. 

Which can hurt your SEO and frustrate users.

To fix the issue, redirect straight from URL A to URL C without stopping at URL B.

This is what a corrected redirect chain looks like:

Corrected redirect chain

A redirect loop occurs when a URL redirects to another URL. And that second URL redirects back to the original URL. This creates an infinite circle of redirects.

Like this:

Redirect loop

This redirection is broken and won’t actually forward visitors or search engines to the destination. 

Fix redirect loops by choosing the “correct” page and ensuring the other page redirects to it. Then delete the other redirect causing the loop.

You can use Site Audit to check for redirect chains and loops.

Run an audit and go to the “Issues” tab and filter for “redirect chain” by typing it into the search bar.

Site Audit Issues tab

Click on the “# redirect chains and loops.” You’ll get a full report of pages with redirect chain or loop errors.

Redirect chains and loops in Site Audit

The report contains a list of pages, their redirect type, and the number of redirects.

List of issues with redirect issues in Site Audit

Log into your CMS and fix each one. 

To sum it up:

  • Fix redirect chains by redirecting the old URL directly to the new URL. Delete any unnecessary redirects in between. 
  • Fix redirect loops by choosing the “correct” page. Redirect to the correct page from the other page. Then delete any other unnecessary redirects causing the loop.

3. Avoid Linking to Pages with Redirects

Say you redirect an old page to a new page. You might have other pages on your site that still link to your old page.

If so, users will be sent to your old link. And then redirected to the new URL. 

Users probably won’t notice this. But that extra redirect can contribute to a redirect chain over time if you don’t remember to maintain it. 

Here’s what the issue looks like:

Linking to a page with a redirect

So, it’s best to change old internal links to your new page’s URL. 

Which looks like this:

Avoid linking to a page that redirects to another

But how do you find links on your website that point to redirects?

It’s simple:

Head to the “Crawled Pages” tab in Site Audit.

Site Audit Crawler Pages report

Then, add your old (redirected) URL into the “Filter by Page URL” space.

Add your to Crawled Pages search bar

After you hit Enter,” you’ll see a report for your specified URL.

Click on it.

Crawled Pages report for one URL

You’ll find a list of internal links pointing to your old URL under the “Incoming Internal Links” section.

Incoming Internal Links on Site Audit

Now, all you have to do is swap the old link for the new link (the redirect target). 

Go to each page in the list and manually change the link. This will fix the error.

4. Redirect to Avoid Duplicate Content

It’s not uncommon to find that a site exists on more than one subdomain (non-www and www, HTTP and HTTPS, etc.). 

For example, http://example.com and https://example.com point to the same domain. 

Search engines view them as separate sites, which isn’t a bad thing by default. However—this can cause duplicate content issues if you aren’t careful.

Essentially, you could split traffic and compete with yourself if Google isn’t sure which version of your site to direct users to.

You can easily resolve this issue by 301 redirecting all variants of a page to a single URL. This will direct Google to your preferred page (the redirect target).

Use redirects to prevent duplicate content in the following instances:

  • Non-www and www URLs
  • HTTP and HTTPS URLs
  • Trailing-slash (/) and non-trailing-slash URLs
  • Capitalized and lower-case URLs

You can find duplicate content on your site in the “Issues” tab of our Site Audit tool.

Filter by “duplicate” to get a list of relevant errors.

Searching for duplicate errors in Site Audit

Click on the # pages have duplicate content issues” error to get a full report.

Pages with duplicate content issues

The tool will give you a list of pages that you may need to redirect. Along with how many duplicate pages exist.

Results of pages with duplicate content issues in Site Audit

Click on the drop-down arrow on the right side of each listing to see the duplicate pages.

Examples of pages with duplicate content

And redirect each duplicate page, as necessary.

Google ignores backlinks that point to a 404 page. And that’s a problem because backlinks are an incredibly important ranking factor.

In other words, you’re not getting any credit from Google for those backlinks pointing to 404 pages.

Here’s a quick fix:

Use our Backlink Analytics tool to uncover 404 pages that have links pointing to them. 

Head to the Indexed Pages tab in your completed report. Tick the box beside “Broken Pages.”

Broken Pages in Backlink Analytics

You’ll get a list of missing URLs that have links pointing to them.

Errors in Backlink Analytics

Reclaim some of that lost authority by 301 redirecting those pages to a close match page.

Redirect FAQs

Do Redirects Pass Page Authority?

Yes, redirects pass authority from the old page to the new page. If there is a close match between each page’s content.

But keep in mind that redirects may not necessarily pass 100% of the original page’s authority.

If you have a legitimate reason to redirect a page, though, it is best practice to implement the redirect.

Are Redirects Bad for SEO?

No, redirects are not bad for SEO. 

But it’s a bit more complicated than that.

The best-case scenario is to avoid needing redirects entirely. That way, your pages won’t lose any authority.

But you’ll likely need to redirect some pages at some point in time. In this case, implementing redirects (correctly) is the best way to help protect your current rankings. 

And avoid losing page authority.

If you move or remove a webpage and don’t redirect the old URL, users and Google will get a 404 when they land on the old URL. 

They’ll be lost. And might bounce from the page.

While 404s generally aren’t thought to be a Google ranking factor, they can be problematic if you point internal links to a page that no longer exists.

In this case, it’s best to redirect to a relevant page rather than let users and search engines fend for themselves.

How Long Should You Keep Redirects in Place?

You should keep permanent redirects in place for at least a year.

(Ideally, indefinitely. That’s best for user experience.

After this time frame, Google says it is able to transfer all ranking signals to the new URL. 

How Do I Test Redirects?

Luckily, testing a redirect is simple.

All you need to do is copy the old URL and paste it into your browser. If it directs you to the new URL after you hit enter, then congratulations! Your redirect works.

If not, see if you made any typos when setting up your redirect.

To check for more complex redirect issues, use Site Audit.

Share
Author Photo
Writer, editor, SEO strategist, and supporter of the Oxford comma. There‘s little I enjoy more than lounging on my couch playing video games and snuggling with my dog.
More on this