Types of Redirects: What’s the Difference and How to Use Them
Contents
What are redirects? And how do different types of redirects affect SEO?
This article will explore these questions without getting too technical.
We’ll also explain:
- Why redirects are so important
- How to add them manually
- And tools you should know about
Let’s dive in.
What are Redirects?
In web development and on-page SEO, redirects are used to send visitors and search engine bots to a different URL.
This is useful when the old URL is no longer required, to move it to a temporary location, consolidate similar pages together, or if you are changing the domain name of the website.
Depending on the purpose of the redirection will depend on the type of redirect to be used.
5 Types of Redirects
The numbers in redirects are known as HTTP response status codes.
Different codes send different requests to the server, which then tells the client (browser) how to respond.
The redirect response codes are three-digit numbers starting with the number 3, ranging from 301 – 308.
Here are the available redirects you should know about.
301 redirect: Moved permanently
A 301 redirect is a permanent redirect that is used when moving an old URL to a new one.
It’s also used when migrating an entire domain name to a new domain name.
When a 301 redirect is in place, the server tells the browser and search engines that the page has moved indefinitely.
This instructs search engines to replace URLs stored in the index with the new URL. And the browser redirects the user to the new page automatically.
The 301 redirect will also pass all the link equity from the old URL to the new one, preserving its page authority.
Other uses include:
- Redirecting old redundant pages to the home page
- Consolidating duplicate content by redirecting them to something similar
- When URLs need to be changed, for redesigns, or for ULR structure changes
302 redirect: Found or moved temporarily
A 302 redirect is used to instruct the browser and search engines that the URL has moved temporarily.
It’s similar to a 301 in regards to the user because they both redirect to the new URL as soon as the old URL is requested.
The difference is how a 302 redirect communicates to Google and other search engines.
It tells search engines that the new URL is temporary and that the old URL will come back at some point.
That means Google will keep the original URL in the index and won’t replace it with the new one.
This is helpful if you want the original URL to retain its rankings and page authority.
The main purpose of a 302 redirect is to show a different page to the user temporarily until the original page is ready to come back.
This could be used for website maintenance, where a page or the entire site redirects to an under-construction page, whilst the site is being updated.
Another use case could be for A/B testing. This is where you want to test a new page layout or design to see if the new page offers a better UX and conversions.
The better design can then be used on the original URL and the 302 redirect removed.
303 redirect: See other
The 303 redirect is used to stop the browser from re-submitting forms when users refresh the page or click the back button.
This is useful in form submissions to prevent the data from being transferred multiple times.
If the URL is refreshed or saved as a bookmark, the response will fetch a different URL, whilst retaining the data collected.
This type of redirect doesn’t have an intended purpose in SEO, because search engines don’t use server-side technology.
307 Temporary redirect
A 307 redirect is similar to the 302 redirect, where they both instruct search engines the redirect is temporary.
The difference lies in how they handle data that’s being sent along with the request.
Using a 302 redirect is more common as it has been around much longer than the 307 redirect. However, using either redirect won’t make much difference in terms of SEO.
308 Permanent redirect
A 308 redirect is a permanent redirect and is treated the same as a 301 redirect.
It tells the browser and search engines that the URL has been moved permanently but retains the HTTP method.
For example, if POST is used as the method, the request will also be POST. This differs from a 301 redirect where a POST request can change to a GET request.
A 301 redirect is the most preferred one to use when redirecting URLs and domains permanently.
Why Are Redirects Important?
Redirects are important for several reasons. They can negatively impact the user or search rankings if they aren’t set up correctly.
From the user’s perspective, clicking an old URL that isn’t redirected, will take them to a 404 page. This offers a poor user experience and will usually leave your site.
So it’s important to set up redirects if you ever delete a page or change the trailing URL that comes after https://website.com/.
If you no longer need the page and there isn’t a similar page it could redirect to, then it’s best to redirect to the home page.
From an SEO standpoint, the most important reason is to preserve link equity.
All links have some equity that passes throughout your site. But if you have broken internal links, it will stop the flow of link equity and lower your domain authority.
Link equity can pass through internal links and from backlinks (links from external sites).
If an article has gotten backlinks, but the page URL has changed or been deleted, link equity will be lost.
So, it’s super important to monitor broken links on your site and maintain an effective internal linking strategy.
How to Implement Redirects
If you’re using WordPress, some plugins make it easier to add and manage redirects.
More on these tools in the next section.
Here are the most common manual ways redirects are carried out.
htaccess
A .htaccess file is used on Apache servers to configure various settings on the server.
It’s also used to create redirects and is one of the more common methods due to the popularity of Apache based web hosting.
Here’s an example of a 301 redirect using htaccess:
This server side redirect will automatically send the user and search engine bots to “https://yourdomain.com/blog/best-wireless-headphones” when visiting the URL “https://yourdomain.com/blog/7-best-wireless-headphones-for-studying”.
This is also a permanent redirect, so it will transfer all link equity to the new URL.
Nginx
Nginx is a newer technology that can be used with Apache to improve server performance.
It sits in front of Apache as a reverse proxy, serving static files like HTML and CSS, while passing dynamic requests like PHP to Apache.
An Nginx 301 redirect would look like this:
listen 80;
server_name oldsite.com;
location / {
return 301 http://newsite.com$request_uri;
}
}
This server side redirect would permanently send all traffic to a new site, helpful when changing domain names.
JavaScript
A Javascript redirect is a client side redirect, meaning they are added to the specific page you want to redirect.
Javascript redirects can be useful when redirecting users after certain actions have been taken on a page or to track clicks and user behavior.
These types of redirects aren’t recommended for SEO purposes, because search engines aren’t able to index Javascript redirects correctly.
A simple Javascript redirect will look like this:
HTML Meta Refresh
A meta refresh is another client side redirect and isn’t recommended for SEO.
This type of redirect happens after a specified period. It’s useful if you need a delayed redirection or to auto refresh the page.
Here’s what a meta refresh looks like:
<meta http-equiv=”refresh” content=”5; URL=http://www.example.com”>
</head>
This will load the page for 5 seconds and then redirect to the URL.
PHP
A PHP redirect is a server side redirect as it runs on the server before the website is sent to the browser.
To implement a 301 redirect from one page to another, here’s what the code looks like:
header(‘Location: /another_page.php’, true, 301);
exit;
?>
In general, it is recommended to use htaccess redirects over PHP, as they are faster and happen before any PHP has been executed.
Redirection Tools
Redirection tools help you add redirections on your site and find errors with broken links.
Here are some redirection tools that are highly recommended.
WordPress plugins
Most people who use WordPress will use a plugin to manage links and redirects.
Some tools help you create redirects, whereas others monitor broken links and 404 errors.
These are some plugins that can help you save time and improve SEO.
- Link Whisper: Our tool Link Whisper automates internal links on your site, but it also shows you a list of broken links. This will indicate which internal links need to be redirected to prevent SEO issues.
- RankMath: RankMath is an SEO plugin that improves how your website shows up in the SERPs. It also has a built-in redirection tool to redirect any URLs that need it.
Site audit and redirect chain tools
Site auditing tools are used to find on-page SEO problems and provide suggestions to make improvements.
One common redirect issue is a redirect chain.
Redirect chains are multiple redirects that happen from the initial URL that was requested.
For example, someone clicks on https://website.com/11-best-electric-bicycles/ which redirects to https://website.com/best-electric-bicycles/, and then redirected to https://website.com/best-electric-bikes/.
They are considered bad for SEO, because they take longer to crawl, can lose link equity, and slow down page speed.
Many tools will help you identify redirect chains. Here are a few popular free choices:
- Screaming Frog: This is a free tool you download on your PC that scans your website for technical issues, including redirect chains. It’s free for up to 500 scanned pages.
- Ahrefs Site Audit: Ahrefs is a paid keyword research tool with a free site audit tool. It scans your site and displays tons of technical details to help you make improvements to your SEO.
- SEMRush Site Audit: SEMRush is another keyword research tool that has a free trial. Their site auditing tool however is also completely free to use to see how well your site’s pages are doing and tips to make improvements.
Conclusion
There you have it. A comprehensive guide on the different types of redirects and how to use them.
To summarize, the most common redirects you’ll use are a 301 and possibly a 302.
You can use a plugin like Link Whisper to monitor broken links and then use a plugin to set up redirections, such as RankMath.
Adding redirections correctly is important as it might cause on-page SEO problems and hurt your rankings.