What is The Difference Between a 301 and a 302 Redirect?

What is The Difference Between a 301 and a 302 Redirect?

301 and 302 are both HTTP status codes. They are very common, but the average user doesn’t see them; they’re codes to help an admin troubleshoot when something goes wrong, and they’re codes that servers use when they talk to each other.

There are actually quite a few status codes. These range from 100, which is a simple continue code, up to 404: page not found, or 504, when a server times out.

Types of Server Redirects

301 and 302 are both redirect HTTP codes, but they’re not the only ones. There are actually several different types of redirects, more than just the ones we typically use. 301 and 302 are the most common, but they aren’t alone.

300 Multiple Choices. This status code indicates to a browser that there are multiple possible options for the destination they’re trying to reach. Think of it sort of like a Wikipedia Disambiguation page. These are fairly rare and of no value to your SEO.

301 Moved Permanently. This is the typical redirect. A 301 redirect is an indicator that the destination of the link has changed URL to a different URL, permanently. For example, when SEOMoz rebranded to Moz, they changed their URL from SEOMoz.com to Moz.com. Every SEOMoz.com page redirected to the corresponding Moz.com page via a permanent 301 redirect.

302 Found. This is also known as the Object Moved or Moved Temporarily redirect code. It’s also widely improperly used. In the actual HTTP specifications, a 302 was meant to simply indicate that the intended URL was not the correct URL for a given resource. Most web systems, however, implemented it in such a way as to become a temporary redirect, and thus it is commonly used as a sort of temporary version of the 301.

In order to differentiate the two intended features of the original 302, the governing body of the HTTP codes standards implemented both the 303 and 307 codes. In reality, neither of these are commonly used, and 302 still works as a temporary redirect.

303 See Other. This is the intended function of the original 302; when a browser makes a PUT call and receives a different URL with a GET response, it is using the 303 protocol. You, uh, can pretty much ignore this if you’re not digging really deep into technical standards. It’s totally irrelevant for your SEO.

304 Not Modified. This is a code used in data caching. If a server has fetched the data of a page in the past, and a client asks for the page, the server will check to see if the page has changed. If the page responds with a 304, it indicates that the server already has the most updated version of the page. The server can then provide what it already has, without having to re-run code, re-fetch assets, or re-generate the page.

304 Page Not Modified

305 Use Proxy. This code is a strange legacy measure that a server uses to tell a client it can only access the server through a designated proxy. It was abused, subsequently ignored by browsers, and has basically been abandoned. The 306 code, similarly, specified that a client should use a specific proxy, and is no longer used.

307 Temporary Redirect. This is what we most commonly think 302 is, and what 302 is generally used for. When a browser asks a server for URL 1, but the URL has been changed temporarily, the server will respond with 307 and the new URL 2. However, since it’s a temporary redirect, the browser will not store this information. The next time the browser asks for URL 1, the server will check again and see if the redirect has been removed.

308 Permanent Redirect. This is meant to be a modern, smoother version of the 301 redirect. When a browser asks a server for URL 1, the server says “actually, it’s URL 2 now.” Traffic will then proceed normally to URL 2, without changing the HTTP method; this allows for data transfer through form submissions to proceed without issue, for example, rather than failing through a redirect.

Out of all of these, there are really only four that you should care about; 301, 302, 307, and 308.

GET and POST

In order to understand which redirect you should use at any given time, you need to learn a little bit about how HTTP works. Bear with me, this gets a little bit technical.

GET and POST are both methods for a browser or client to communicate with a server. To put it simply, GET is the browser asking the server for specific data. POST is submitting data to a server to be processed.

Get vs Post

GET requests can be cached. They remain in browser history, can be bookmarked, and are used specifically to retrieve data. “Grab me the content on this URL” is a GET request, essentially.

POST requests are more like scripts to be processed by a server. Have you ever used a web-based search form that, when you hit the “back” button or try to refresh the page, threw up a “you need to resubmit data to a form to continue” warning? This is because it was a POST request. POST requests are not cached, do not stay in browser history, and cannot be bookmarked, because they are more or less a set of commands to the server rather than a request for a static resource.

The core, primary difference between a 301 redirect and a 308 redirect is that a 308 redirect does not allow changing from POST to GET. The same goes for a 302 and 307; the 307 is not allowed to change.

When is this ever relevant? The answer is, quite rarely. If you have a form on URL 1 that pulls data from URL 2, and you’re changing URL 2 to URL 3, the form will break without specific action. Using the higher numbered redirects, 307 or 308, will be important in this scenario.

In the vast majority of cases, particularly when you’re just concerned with SEO, you’ll want to stick to 301 and 302 redirects.

Should you ever use a 307 or 308 redirect when SEO is your primary concern? In general, the answer is no. Both 307 and 308 are HTTP 1.1 standards. While these are newer and more efficient, they are not necessarily supported widely amongst servers, browsers, or search engines. Until such time as they are more widely adopted, it’s best to leave your redirects to a 301 or 302.

Which Should You Use?

As mentioned up above, the 301 redirect is a permanent redirect and the 302 is a temporary redirect. Which one should you use, and when?

The 302 redirect is considered a temporary change and is not cached or saved. Essentially, a 302 redirect is not considered to be important by a search engine. They will use it if they’re crawling your site, but they will consider the original link to be the real link.

302 redirects can be valuable in some situations. They can be used for geotargeting, for split testing, for some forms of user tracking, and for redirects that are meant to be temporary. For example, changing up a URL during maintenance of your site so that the content is still available on a different URL could be done with a 302.

302 redirects do not pass PageRank or link juice from the old URL to the new URL. If you are changing the URL of your site from one to another, as in the Moz example, you do not want to use the 302 redirect. Doing so would essentially leave all of your site value behind on the old URL.

302 Illustration

Google may, in some cases, be smart enough to recognize that a 302 was misused as a 301 and that the new site should have the value of the old site. However, this is likely to take some time, if it happens at all, and they will likely give you less value than they would with a permanent redirect. You are essentially saying to Google that you don’t know enough to migrate a site properly, and they are going to keep that in mind while crediting you. You’ll lose a significant chunk of value using a 302 redirect when you mean to use a 301.

The 301 redirect is, as mentioned, intended to be permanent. If you are migrating from one URL to another, merging two sites, or otherwise making changes to the URL that are not intended to be reverted, a 301 redirect works.

301 redirects are intended to inform browsers and search engines of the move from one URL to another. Think of it like sending a change of address form to your local post office when you move. Without filing it, your mail won’t arrive at your new house.

In general, if you know the change is going to be permanent, you should use a 301. If you want to pass PageRank to your new URL, use a 301. If you have a temporary change of URL case, you can use a 302, but do not expect Google to refer link juice through it.

How Long Should a Redirect Last?

A 301 redirect is meant to be permanent, but how permanent is permanent? How long should you maintain the redirect?

Google’s representative John Mueller addressed this situation and indicated that 301 redirects should be in place for the long run. “…that could be something maybe a year, or ideally even longer than a year, so that we can really be sure that everything that was pointing at the old URLs is pointing at the new URLs.”

301 Redirects Long Term

Keeping a redirect in place for the long term is important for Google to make sure they have properly indexed and redirected everything about the old page to the new. It’s also important for users who have the old page bookmarked, to change their bookmarks. The moment you remove the redirect and someone tries to visit the old page, they will be greeted with a 404.

The only reason Google doesn’t say the redirect should be permanent is because they recognize domain names expire or change hands. Moz is still paying for the SEOMoz.com domain name, so they can keep the redirect in place. If they wanted to stop paying for the domain name, or if they forgot to renew and someone else bought it, all old SEOMoz links would break or be at the control of whoever owns the domain.

For “small” redirects, like changing a subdomain or subfolder of a URL but keeping the main domain name, you can keep the redirect in place indefinitely with no issues. It doesn’t put strain on your server or budget to do so.

For larger redirects, like changing your domain name entirely, Google recommends keeping the redirect in place for at least a year. After a year, start looking at your server logs. If people are still being redirected from the old URL to the new URL, figure out where they are coming from. It might be old active links, it might be users with bookmarks, it could be anything. Figure out what the source is and take steps, if you can, to change the source to the accurate URL before you remove and abandon the redirect. If you have the ability to keep the old domain name indefinitely without strain on your budget, just to keep the redirect alive, feel free to do so.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

The Psychology of Clicks: Deciphering User Behavior for SEO Success

Nov 30, 2023 by Sreejith Mullappilly

In the vast world of the internet, every click is a conscious decision...

How To Increase the Popularity of Your Vacation Rental: The Significance of Effective Advertising

Nov 29, 2023 by Sophia Smith

Navigating the competitive world of vacation rentals necessitates more...

How To Run Successful Webinars for Lead Generation

Nov 28, 2023 by Mustafa Bugti

Running a successful webinar for lead generation is a smart way to con...