These are two of the most common types of redirect, but are often confused for each other. We explain how to use them correctly, and why it still matters.
So what’s the difference between 301 vs. 302 redirects, which one should you use, and when? We’ll explain all you need to know in this article.
And if you want to learn more, don’t forget to check out our beginner-friendly guide to redirects.
[Editor’s note: article updated 12/12/21]
First of all, let’s take a step back, and talk about server-side redirects – which is how both 301s and 302s work, along with other 3xx redirects like 307s etc. Check out our complete guide to status codes for a complete explanation of each.
After we’ve explained (briefly) how server-side redirects work, we’ll take a deeper look at the difference between 301 vs. 302 redirects, and when you should use each.
These occur when when a web browser or a search engine bot requests a URL, making a request to the server. The web server then delivers a status code which 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.
The main danger with redirects is losing hard-won page rank: if you implement them wrongly then you might see your search rankings (and organic traffic) drop sharply.
For example, if you 301 redirect to a completely unrelated page or domain, search engines like Google will no longer rank you for the keywords it once did. Ouch.
Another thing to watch out for are redirect chains: these are when you have multiple redirects in place, such as from URL A to URL B, then to URL C, and so on. They can slow things down for users, and frustrate Google’s crawler (although fewer than 10 redirects are theoretically okay).
Something that’s definitely not okay however are redirect loops: these happen when a user (or crawler) lands on URL A, gets sent to URL B, then URL C, then back to the beginning, for example.
All of these pitfalls can be quickly identified and fixed with help from the Ryte Suite (see below).
So now that’s out of the way, let’s now examine when you should use each of them.
A 301 is the most important one for SEO purposes. It ensures that one URL is permanently redirected to another, and refers to the status code issued by the server (“301, moved permanently”). The redirect passes the link juice from the “old” to the “new” URL, so that no search ranking is lost (Google has confirmed this).
Domain transfer: Redirects ensure that the original URLs and directories are redirected to the new URLs and directories, preserving link juice and search rankings.
Changes to the website protocol: If you encrypt your website with an SSL certificate using https, a 301 redirect is a practical way of redirecting your site from http to https.
URL structure changes: If you change the directories of your website, thereby changing the URL structure, a 301 redirect will ensure that visitors can immediately find the new URLs.
Transfer of individual documents: If you are offering a PDF for download at a specific URL, but you have redesigned the download area, a 301 redirect can point to the new download location.
Keyword cannibalization: If you notice that you have two webpages (such as blog articles) that are extremely similar, you should 301 redirect the one that generates less organic traffic.
Duplicate content: Similar to the previous point, if you have two versions of a webpage or entire domain (for example, https://www.domain.com and https://domain.com) then you should use a 301.
Generally speaking, 301s maintain the usability of your website, and help you to offer your site visitors a flawless user experience. Ultimately, the redirect is a practical and useful way of optimizing your website’s user experience.
A 301 redirect can be set up indefinitely. As a general rule however, you should always wait until Google has indexed the new URLs before removing it (and of course, try to ensure that any inbound links to the original URL are changed to the new URL).
You can run a site query in Google to test if a new URL has already been indexed (simply type “site:domain.com URL”).
The key distinction between a 301 vs. 302 redirect is its duration. While a 301 is “permanent”, a 302 is temporary (so Google indexes the source URL, rather than the destination).
How long should a temporary 302 last? As long as needed – Google will turn it into a permanent 301 redirect if it decides that it is no longer temporary.
Two possible uses of 302 redirects are:
These are usually implemented using the Apache server’s .htaccess file. This is a set of instructions for the server to execute when an http-request occurs, and specifies the URL to which the client should be redirected.
The .htaccess file is stored as a text document in the main directory, on the same level as the index.php or index.htm sites.
For such redirects, the “mod rewrite” module of the Apache server must be enabled. This is accomplished by inserting various instructions in the .htaccess file that tell the server how to proceed with a specific URL or directory.
An example: In this case, page 1 will permanently redirect to page 2.
RewriteRule Page1.html page2.html [R=301]
If a 302 redirect is implemented, then in this example you must replace 301 with 302.
Yes: All 301 and 302 redirects pass on full page rank, if implemented correctly. For more on this topic, read our complete guide to redirects.
In the “status codes” report under Search Engine Optimization, you will find the status codes of all your pages and thus, which pages are redirected via 301 or 302 redirect.
Figure 1: Check your status codes at a glance with Ryte Search Engine Optimization
After clicking on the yellow tab, you’ll see all URLs that have a status code 301 (permanent redirect). You’ll also be able to see the destination URLs.
Figure 2: Discover the destination URLs of 301 redirects with Ryte
By checking your redirects regularly, you’ll ensure that your website offers a good user experience, which can improve your search rankings.
Both 301 and 302 redirects pass on all page rank, when implemented correctly.
301 redirects are an effective way to avoid duplicate content and other issues, and are generally intended for permanent use.
302 redirects should only be used to a limited extent and for temporary redirects, as Google does not index the destination URLs.
Optimize your website with a free Ryte trial
Published on 12/12/2021 by Philipp Roos.
Philipp is an extended member of the Ryte family and supports Ryte with the latest SEO know-how and digital marketing news.
Own the SERPs with the only Platform using exclusively Google Data.Book free demo