Skip to content

302 Found

Description

The 302 Found status code indicates that the requested resource has been temporarily moved to a different location, but the client should continue to use the original URI for future requests. This status code is used for temporary URL redirection.

The temporary URI should be given by the Location field in the response. Unless the request method was HEAD, the response should include a short hypertext note with a hyperlink to the new URI.

This status code is commonly used in the following scenarios: - During website maintenance - For A/B testing - For tracking clicks through a redirect - For temporary promotions or special events - When a resource is temporarily available at a different location

Unlike the 301 Moved Permanently status code, search engines and other user agents should not update their references to the resource upon receiving a 302 Found response, as the change is expected to be temporary.

Syntax

The server responds with a 302 Found status and includes the temporary location:

HTTP/1.1 302 Found
Location: https://example.com/temporary-path
Content-Type: text/html
Content-Length: [length in bytes]

[Optional response body with a hyperlink to the temporary location]

Examples

Maintenance Page Example

A client requests a page that is temporarily unavailable due to maintenance:

Client Request:

GET /dashboard HTTP/1.1
Host: app.example.com

Server Response:

HTTP/1.1 302 Found
Location: https://app.example.com/maintenance
Content-Type: text/html
Content-Length: 174

<!DOCTYPE html>
<html>
<head>
  <title>Temporarily Moved</title>
</head>
<body>
  <p>This page is temporarily unavailable. Redirecting to <a href="https://app.example.com/maintenance">maintenance page</a>.</p>
</body>
</html>

Tracking Redirect Example

A client clicks on a link that goes through a tracking system before reaching the destination:

Client Request:

GET /click/product-123 HTTP/1.1
Host: links.example.com

Server Response:

HTTP/1.1 302 Found
Location: https://store.example.com/products/123?source=email-campaign
Content-Type: text/html
Content-Length: 158

<!DOCTYPE html>
<html>
<head>
  <title>Redirecting</title>
</head>
<body>
  <p>Redirecting to <a href="https://store.example.com/products/123?source=email-campaign">product page</a>...</p>
</body>
</html>

Temporary Promotion Example

A client requests the homepage during a special promotion period:

Client Request:

GET / HTTP/1.1
Host: example.com

Server Response:

HTTP/1.1 302 Found
Location: https://example.com/special-sale
Content-Type: text/html
Content-Length: 165

<!DOCTYPE html>
<html>
<head>
  <title>Special Promotion</title>
</head>
<body>
  <p>Redirecting to our <a href="https://example.com/special-sale">special promotion page</a>!</p>
</body>
</html>

Summary

The 302 Found status code is an important tool for temporary URL redirection, allowing websites to temporarily direct traffic to alternate locations while maintaining the original URL for future use. It's particularly useful for scenarios like maintenance periods, special events, or tracking systems where the redirection is not intended to be permanent. Unlike the 301 Moved Permanently status, the 302 Found status signals to clients and search engines that they should continue using the original URL for future requests, as the current redirection is temporary.