Skip to content

HTTP status code 302 Found

What is HTTP Response Status Code 302 Found?

HTTP response status code 302 Found indicates that the requested resource is temporarily available at a different URL. The client should continue to use the original URL for future requests.

When is HTTP Response Status Code 302 Found Used?

The 302 status code is used when a resource is temporarily moved, such as during maintenance or content updates, and will return to the original URL later.

Significance of HTTP Response Status Code 302 Found in Web Development?

The 302 status code allows servers to redirect users temporarily without affecting the original URL’s SEO value. It ensures users are directed to the correct content during short-term changes.

How to Implement HTTP Response Status Code 302 Found?

To implement a 302 status code, set the server to respond with this code and include the temporary URL in the Location header for the request.

FAQs

  • When should I use a 302 status code? Use it for temporary redirections where the original URL will be restored later.
  • Does 302 affect SEO like 301? No, 302 is considered a temporary change and does not transfer SEO authority like 301.
  • Can I use 302 for permanent redirects? No, for permanent changes, use a 301 status code instead.

Here are two examples for the HTTP status code 302 Found

<h2>Example 1: Temporarily Redirecting to a Maintenance Page</h2>
<pre>
# Client sends a GET request for a website that is currently under maintenance.
GET /home HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 302 Found
Date: Wed, 09 Oct 2024 12:30:00 GMT
Server: Apache/2.4.41 (Ubuntu)
Location: https://www.example.com/maintenance

# The server temporarily redirects the client to the maintenance page.
# The original URL (/home) should still be used in the future once the maintenance is complete.
</pre>

<h2>Example 2: Redirecting a Form Submission to a Confirmation Page</h2>
<pre>
# Client sends a POST request to submit a form.
POST /submit-form HTTP/1.1
Host: www.example.com
Content-Type: application/x-www-form-urlencoded

name=John&[email protected]

# Server Response
HTTP/1.1 302 Found
Date: Wed, 09 Oct 2024 12:35:00 GMT
Server: Nginx/1.18.0
Location: https://www.example.com/confirmation

# The server temporarily redirects the client to a confirmation page.
# The client is directed to view the confirmation page but should use the original form URL for future submissions.
</pre>

I

n these examples, the 302 Found status code is used for temporary redirection:

  • Example 1 demonstrates a scenario where a user is temporarily redirected to a maintenance page, but the original URL should still be accessed when the maintenance is over.
  • Example 2 shows a redirection after form submission, sending the user to a confirmation page. However, the original form URL remains valid for future use.

The Location header in each response provides the URL where the client is redirected temporarily, but it does not indicate a permanent change.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top