Temporary forwarding is a great way to put your URL to work until you get your site up and running. It can also be used to redirect users if your domain location has changed or is temporarily unavailable. The 302 status code is at the heart of temporary redirects.
HTTP Status Codes
Think of HTTP status codes as a server-to-browser communication tool which triggers redirections (sending the user to an alternative or new webpage) when necessary.
Normally, when you type a URL into a browser, the browser sends a request to the appropriate webserver. The server then sends back the requested domain, which displays on your browser.
When URL forwarding is in use, the server uses a list of redirects, often listed in the .htaccess file, to check for redirects. If it finds the redirection in the list, a 3xx redirect will be sent back to the web browser, along with the new URL, redirecting the browser to the new web page without the user having to do anything.
The two main types of 3xx redirects are a 301 redirect, which means the URL has moved permanently. The other type, which we will focus on here, is a 302 redirect, which should only be used when the redirect is temporary.
3xx Status Codes Overview
- 301 moved permanently
- 302 found
- 304 not modified
- 305 use proxy
- 307 temporary redirect
302 Redirect Overview
Known as “302 found”, the 302 redirect is similar to a 301 redirect. However, with a 302 redirect the link equity (also commonly referred to as as link juice) value is not passed over to the new location, and URLs are not replaced in search engine results.
Therefore, unlike a 301 redirect which means the location has moved permanently, you don’t want your users to be sent to a new location permanently.
For example, say part of your website is being redesigned. While your developers are working on your site, it’s not functional. The old website no longer exists either, because it’s in the middle of being changed. So, to avoid users being shown an error message, you can use a 302 found to display a temporary page instead.
A 302 redirect may also be used to collect data, or when performing A/B testing. Generally speaking, its use is rare because most people redirect with a 301 redirect instead.
A 302 isn’t intended to be permanent, nor is it a replacement for a fully functioning website or page. It simply acts as a go-between, so that users can access what they need, or at least be informed about the status of a page or a website.
302 Redirect Vs 307 Redirect
Given a 307 redirect is known as a 307 temporary redirect, it’s easy to get confused. Both are extremely similar with only subtle variations.
A 302 redirect is intended to be a temporary measure but is slightly vague on why it is being used as a temporary redirect. It is generated by the server and should only be used for HTTP/1.0 clients.
A 307 redirect states that the requested URL will be back shortly. It is an internal redirect response generated by the browser.
Technically, you could use either though for SEO purposes, a 302 redirect is the preferred option. Unless of course, the move is permanent in which case, a 301 redirect would be correct.
The reference documentation for these redirects can be found in the IETF RFC 7231 document.
While a 301 redirect is more common, sometimes a 302 redirect is the right thing to do, especially when the location you are sending users to is only temporary. Take care to ensure you select the right redirect, as a 302 redirect can affect your link equity.
However, it is still preferable to use a 302 redirect rather than have users get a broken page error.
With any 302 redirect, make sure you keep a short time frame in mind. This will reduce any negative impact on your SEO, especially as users are more likely to bounce off the page if they don’t find what they expected after clicking your result on the SERP.