Specification of the HTTP status code 302
The 302 Found status code indicates that the target resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client ought to continue to use the effective request URI for future requests.
The server SHOULD generate a Location header field in the response containing a URI reference for the different URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the different URI(s).
Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 (Temporary Redirect) status code can be used instead.
Source / Quote by: The 302 Found HTTP Status Code is specified by section 6.4.3 of RFC7231.
How to throw a 302 statuscode with PHP?
Test the 302 HTTP status code
In order to be able to display the HTTP status code (in this case 302 Found) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:
Browser compatibility of the 302 status code
|Firefox for Android||Yes|
|Safari on iOS||Yes|
What SEO impact does the 302 status code have?
The digital world of search engine optimisation (SEO) is full of nuances, each of which has its own influence on a website's ranking. One of these nuances is the often misunderstood HTTP status code 302 Found. This code, which stands for "Found", used to be called "Moved Temporarily". It signals that a particular web resource is temporarily available elsewhere. But what does this mean for SEO?
First of all, it is important to emphasise that not all redirects are the same. While a 302 Found status code represents a temporary redirect, a 301 status code indicates a permanent shift. This distinction has profound implications for a website's SEO.
A large part of a website's SEO performance comes from its "link juice" or "link authority". When a page is permanently redirected using a 301 redirect, this link authority is largely transferred to the new URL. However, this does not happen to the same extent with a 302 Found redirect. Since search engines regard the 302 Found redirect as temporary, they assume that the original URL will soon be active again. This can lead to the link authority remaining with the original URL, even if the content can actually be found elsewhere.
Another problem with the 302 Found status code in terms of SEO is the issue of indexation. Search engines might keep the original URL in the index due to the temporary nature of the 302 Found status code. This could make them reluctant to index the new URL as it is seen as less stable or permanent.
If such a temporary redirect persists for a longer period of time, it can become a challenge for search engines. They may have difficulty deciding which version - the old one or the new one - to display in search results. This can lead to unpredictable and often undesirable behaviour in search rankings.
This does not mean, however, that the 302 Found status code is not justified. In situations where content is really only being moved for a short time, such as during maintenance or A/B testing, it is entirely appropriate.
In summary, the choice between a 302 Found and a 301 redirect should not be taken lightly. Each redirect has its own SEO implications, and webmasters should carefully consider which status code to use and when. For permanent changes, a 301 redirect should almost always be preferred to maintain SEO integrity. The 302 Found is a powerful tool, but only if it is used correctly.
Constants in programming languages
External links with more information about HTTP status code 302:
Optimizing a website for search engines (SEO) is a complex undertaking. One of the often overlooked but crucial aspects for a good ranking are HTTP status codes. These small, three-digit codes info...