RedirectPath.dev
Tools

Status codes · Practical guide

301 vs 302 vs 307 vs 308 redirects

301 and 308 describe permanent moves; 302 and 307 describe temporary moves. Use 307 or 308 when the method and body must be preserved: 301 and 302 allow POST to become GET. A successful page navigation does not answer both questions. Use the status table, check the public GET response, and test forms or API clients separately before deploying a change.

Choose a redirect for a concrete move

Suppose a public installation guide moves permanently from /old-install to /guides/install. The response below shows the intended status and headers for that GET page. Configure the redirect in the layer that owns the old route.

The five-minute cache lifetime makes this example easier to revise during rollout. It does not make the move temporary. RedirectPath can verify the GET status and destination, but cannot establish how a form submission or API payload reaches its next handler.

HTTP/1.1 301 Moved Permanently
Location: https://example.com/guides/install
Cache-Control: max-age=300
  1. Replace the example addresses with an old page and its equivalent replacement on a site you control.
  2. Request the old deep link and check that its Location points directly to the intended destination.
  3. Open the final page, confirm the replacement content and update internal links to its new address.

Reference: MDN: Redirections in HTTP

Separate permanence from method handling

For GET pages, choose permanence according to the real move. For endpoints accepting data, also decide whether the destination performs the original operation or displays its result. Use this table for automatic redirect handling; confirm the behavior of the actual client you support.

After successfully processing a form, a 303 can send the browser to a confirmation page with GET. A 307 or 308 instead asks the next endpoint to receive the original method and body. That endpoint must be prepared to handle them. A redirect does not itself prevent duplicate submissions.

Separate permanence from method handling
StatusIntended useWhat happens to POST
301 Permanent page move May change to GET; do not rely on body preservation.
302 Temporary page routing May change to GET; do not rely on body preservation.
303 Retrieve another resource, often a confirmation Follow with GET to retrieve the result.
307 Temporary move of the same operation Preserves the method and body.
308 Permanent move of the same operation Preserves the method and body.

Reference: RFC 9110: Redirection status codes

301 vs 308: a permanent move with different method rules

Both statuses describe a permanent move. Choose 308 when a client following the redirect must keep the request method and body. With 301, a client may follow POST with GET. For an ordinary GET page, permanence alone does not distinguish these two codes.

RedirectPath sends GET only. Its result proves the observed status and destination, not that your payment form or API safely replays a body. Use the controlled staging check below for that separate question.

Reference: RFC 9110: permanent redirects

302 vs 307: temporary routing and POST preservation

Both statuses leave the original URL relevant for future requests. A 307 preserves the method and body; 302 permits POST to become GET. If the operation already succeeded and the next page should display its result, consider 303 instead of asking another endpoint to repeat the operation.

Reference: RFC 9110: temporary redirects

Keep search signals and caching separate

Google uses permanent redirects as a signal that the destination should become canonical. Temporary redirects express a different intent and do not provide that same signal. Neither status guarantees a ranking gain or an immediate change in search results. Map moved content to its relevant replacement, not a generic homepage.

Caching is another decision. A 301 or 308 can be cached heuristically without an explicit freshness lifetime; temporary redirects can also be cached when suitable cache controls allow it. Temporary therefore does not mean uncached. Set a deliberate lifetime, check CDN behavior and keep a rollback plan before extending it.

Changing the server rule does not immediately remove a redirect already stored elsewhere. Verify with browser caching disabled, then test normal visits too. Purge the affected CDN entry when your deployment requires it; a browser cache setting does not purge the edge.

Reference: Google Search Central: Redirects and Google Search

Inspect the destination as well as the code

These macOS/Linux commands use GET. The first exposes the initial response; the second follows the chain and prints its final URL and status. Replace the example URL with your own. Do not substitute curl -I: HEAD can take a different application path.

Read each Location and check the required path and harmless sample query parameters. A final 200 can still contain a login screen, soft error or unrelated page, so inspect the content in a browser. RedirectPath redacts query values; verify value preservation locally when it matters.

curl -q -sS --max-time 30 -D - -o /dev/null 'https://example.com/old-install'

curl -q -sS -L --max-redirs 10 --max-time 30 -D - -o /dev/null \
  -w '\nFinal URL: %{url_effective}\nStatus: %{http_code}\n' \
  'https://example.com/old-install'

Reference: curl: Redirects and response inspection

Test POST behavior on a harmless endpoint

Create a staging probe route that redirects to a handler recording only the test method and sample body, without performing business operations. Replace staging.example.com below with that host and check the destination before following it. These commands send two separate test submissions.

The first command inspects the redirect without following it. The second shows outgoing methods in verbose output; verify the body in your probe handler. With normal curl behavior, 301, 302 and 303 change this POST to GET, while 307 and 308 retain it. Do not add -X POST or --post301/302/303: those overrides change the behavior being tested.

curl -q -sS --max-time 30 -i --proto '=https' \
  --data-raw 'probe=redirect-check' \
  'https://staging.example.com/redirect-probe'

curl -q -sS -v -L --max-redirs 3 --max-time 30 --proto '=https' --proto-redir '=https' \
  --data-raw 'probe=redirect-check' -o /dev/null \
  'https://staging.example.com/redirect-probe'
  1. Confirm the expected method and payload with the real browser form or API client in staging.
  2. Deploy the redirect, rescan representative public GET URLs and check their content.
  3. Record the rule owner, cache lifetime and rollback procedure alongside the URL mapping.

Reference: MDN: 303 See Other and form results

Keep reading

Related guides

All guides & reference
Quick reference

HTTP status code reference for redirects and endpoints

Compare 301, 302, 303, 307 and 308, then interpret common endpoint errors and redirect stop reasons.

Open reference