ServerField Server operations and website growth
SEO and site moves HTTP standards and official documentation Updated July 29, 2026

301, 302, 303, 307 and 308 redirects: differences and configuration 2026 guide

A redirect is not complete just because it sends visitors somewhere else. Decide whether the move is permanent or temporary, whether POST and API methods and bodies must be preserved, and whether the old and new URLs serve the same purpose. Then plan a single-hop implementation, search signal updates, testing and rollback.

Published January 8, 2025 Last reviewed July 29, 2026 18-minute read By the Finite Field editorial team
This article provides general technical information. The correct configuration depends on whether the CDN, load balancer, web server, CMS or application owns the redirect. Before changing production, save the configuration, URL mapping and rollback procedure, then test in staging and on a limited set of URLs.

Redirect design is not a matter of memorizing 301 versus 302. Identify the final URL a visitor needs, and combine status codes, Location, internal links, canonical URLs, sitemaps and test evidence into one change plan so search engines, browsers, API clients and caches receive a consistent intent.

The short answer

Use 301 for a permanent move of ordinary pages. Choose 307 or 308 when the method must be preserved.

For a permanent URL change to a company site or article, with no plan to restore the old URL, 301 is the usual choice. For forms, APIs or webhooks that must retain the HTTP method and body after redirecting, consider 307 for a temporary move or 308 for a permanent move. To show a result page with GET after a POST, consider 303; for a temporary destination before returning to the original URL, consider 302.

When a removed page has no equivalent replacement, return 404 or 410 rather than redirecting everything to an unrelated home page. As a practical target, send each old URL directly to its final destination in one hop.

Permanently move an ordinary page301. Update internal links, canonical URLs, hreflang and sitemaps to the new URL.
Temporarily send visitors elsewhere302. Set a return date, an owner and a monitoring period in advance.
Show a completion page after POST303. Retrieve the result with GET as part of a design to prevent duplicate submissions.
Preserve the method for an API307 for a temporary move; 308 for a permanent one. Test the body, authentication, signatures and client support.

What is a redirect? Its role in SEO and user experience

An HTTP redirect is a response with a 3xx status and a Location header that tells the client to refer to another URL. It is used for URL changes, HTTP-to-HTTPS consolidation, domain moves, temporary moves and navigation after form submission.

In Google Search, 301 and 308 provide a permanent signal that the destination should be considered canonical; 302, 303 and 307 provide a temporary signal that the original URL should remain in search results. Redirects alone do not guarantee rankings or the timing of replacement. Google also considers content equivalence, internal links, canonical URLs, sitemaps, crawling and reprocessing.

Five codesCompare 301, 302, 303, 307 and 308
Two decisionsChoose permanence and method handling
One hopSend each old URL directly to its final destination
What a redirect is not

Do not substitute redirects for authentication, authorization or error handling

Hiding login requirements, permission failures, missing resources or server errors behind 3xx responses obscures the cause and responsibility. Design authentication responses such as 401 and 403, missing-resource responses such as 404 and 410, and appropriate 5xx maintenance or error responses separately.

Decide first

Record the reason and end conditions in the change request

Determine whether the move is permanent or temporary, whether the destination is equivalent, whether to preserve the method and query, and who will remove the redirect and when. The status code expresses those decisions.

Compare 301, 302, 303, 307 and 308

Choose by asking whether the move is permanent and whether the same method and body must be used after the redirect. Include login, payment, API, webhook and file-upload flows as well as GET pages.

Comparison of 301, 302, 303, 307 and 308: permanence, method, SEO signals, use cases and cautions
CodeDurationMethod after redirectMain meaning for Google SearchTypical useConsiderations
301PermanentSome clients change POST to GETSignal to consider the destination canonicalPermanent moves of ordinary pages, articles, categories or domainsMay be cached. Confirm that there is no plan to restore the old URL.
302TemporarySome clients change POST to GETIndicates an intent to retain the original URL in search resultsShort maintenance or a temporary promotionManage the end date, restoration of the original URL and canonical URL.
303TemporaryRetrieve the destination with GET or HEADTreated as a temporary redirectA completion or result page after a successful POSTDuplicate submission, retries on failure and visibility of the result URL
307TemporaryThe method must not be changedIndicates an intent to retain the original URL in search resultsA temporary API, webhook or upload destination changeTest the body, authentication, cookies, signatures, CORS and destination.
308PermanentPreserves method and bodySignal to consider the destination canonicalPermanent API or submission endpoint moves and HTTPS normalizationCheck long-lived caches and older client support.

With 301 and 302, historical client behavior can change a POST to GET. When a method change is unacceptable, choose 307 or 308 and test the clients you actually use.

307 does not mean more secure than 302. The guarantee of 307 and 308 concerns method preservation during automatic redirection. TLS, authentication, authorization, cookies, CORS, input validation and destinations for sensitive information require separate security design.

Which redirect should you choose?

Start with the requirements rather than choosing from a list of codes. Do not treat ordinary GET pages and submission flows as if they were the same.

Is the move permanent, with no plan to restore the old URL?
→
For an ordinary GET page, use 301. If a POST or API must preserve its method and body, consider 308。
Is the redirect temporary, with a return to the original URL?
→
For primarily GET traffic, consider 302. To preserve the submission method and body, consider 307。
Do you need a separate result page after a POST?
→
303. The client retrieves the result with GET, helping reduce duplicate submissions when users refresh or navigate back.
Was the page removed with no equivalent replacement?
→
404 or 410. Do not redirect to an unrelated home or category page.

Common goals and candidate responses

01

Changing a URL slug

Use 301 if the old and new pages are equivalent and the change is permanent. Update internal links and canonical URLs.

02

Consolidating HTTP to HTTPS

301 is common for websites. Consider 308 when method preservation must be explicit for APIs, and test every client.

03

Short maintenance

Use 302 or 307 for a temporary move back to the original URL. For an outage or maintenance response, 503 with Retry-After may be more appropriate.

04

Completing a form submission

After saving the POST result, send the client to the completion page with 303 to avoid resubmission on refresh.

URL mapping and site moves without SEO surprises

Before implementing a site move, map old URLs to their final destinations. Include externally referenced assets such as images, video, JavaScript, CSS and PDFs. Combine sitemaps, access logs, Search Console, CMS listings and linked URLs to build the inventory.

URL MAPPING / MINIMUM COLUMNSDecide before migration
Source and final resultOld URL | final URL or 404/410 | status | equivalence
Request handlingMethod preservation | body | query | case | trailing slash
Operations and evidenceResponsible layer | activation time | end conditions | owner | test result | recovery version

Collect old URLs comprehensively

Review sitemaps, server logs, analytics, Search Console, CMS publication lists and external links. Include seasonal pages, old campaigns, images and PDFs.

Map each URL to a final destination that serves the same user purpose

Map an article to the same article, a product to its successor and consolidated pages to their combined destination. Return 404 or 410 if no equivalent exists; do not funnel unrelated pages to the home page.

Update search signals on the new site

Align self-referencing canonicals, hreflang, internal links, sitemaps, structured data and OG URLs with the new URLs. Use the mapping to check that signals do not still point at old URLs.

Redirect permanently and directly to the final URL at the server

For permanent moves involving URL changes, use 301 or 308 and send A directly to C rather than through B. Do not duplicate the same rule at multiple layers such as a CDN and web server.

Test every URL before and after launch and monitor Search Console

Record status, Location, final response, key user actions, 404s, 5xx responses and redirect counts. For domain moves, check whether Change of Address applies and submit the new sitemap.

Avoid: redirect chains
Old URL A→Old URL B→New URL C

Each hop adds latency and a potential failure point, and makes old rules harder to remove.

Prefer: a direct path to the final URL
Old URL A→Final URL C

Update all entry points, including earlier URLs, to the current final URL.

Generally, keep redirects in place for at least one year after a site move. For permanent moves, keep redirects longer where practical for external links and old bookmarks. Before removal, check access to and links pointing at the old URLs.

Causes and fixes for redirect loops and chains

A loop may involve more than one configuration line. If a CDN, load balancer, web server, CMS and application each normalize the scheme, host or path, their decisions can cycle out of sight of visitors. First decide which layer owns the final decision.

1

Assign one owner for each redirect

Document which layer owns HTTPS, www, trailing slashes and old paths, and do not duplicate the same decision.

2

Place exact matches and exceptions before broad rules

Evaluate ACME challenges, health checks, admin paths, webhooks and specific retired URLs before directory-wide or host-wide rules.

3

Check protocol awareness after TLS termination

When TLS terminates at a load balancer, Apache or an application behind it may see HTTP.X-Forwarded-Proto should be trusted only when a controlled proxy overwrites external values and direct access to the backend is restricted.

4

Detect self-references and cycles in the redirect graph

Treat URLs as vertices and Location values as edges to detect A→A, A→B→A and multiple hops automatically. Test the full mapping, not just sample URLs.

5

Align the signals for the final URL

If redirect destinations, internal links, canonical URLs, hreflang, sitemaps and structured data point to different URLs, processing can be delayed even when the redirect itself works.

Loop example
CDN: redirect to HTTPS→Backend: sees HTTP↺

TLS termination and trust in forwarding headers do not agree.

Fix
Trusted CDN→Correct protocol→200

Discard external header values and assign one responsible layer.

Apache, NGINX and PHP redirect examples

Do not paste examples unchanged. Adjust for the canonical host, TLS termination, existing rules, queries and the application's base URL. Record syntax checks, diffs, reloads and immediate recovery commands in the change request.

Apache: prefer Redirect for simple mappings

Place a site-wide HTTP-to-HTTPS redirect in a dedicated port 80 VirtualHost to make ownership clear. Adding unnecessary mod_rewrite rules for simple redirects makes ordering and exceptions harder to understand.

Apache VirtualHost: HTTP to canonical HTTPS
<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  Redirect permanent / https://example.com/
</VirtualHost>

For a permanent directory move, check whether the remainder of the original path must be carried to the new path.

Apache: old directory to new directory
Redirect permanent /old/ https://example.com/new/
When a load balancer or CDN terminates TLS, checking only Apache's %{HTTPS} can cause a loop.X-Forwarded-Proto may be used only if a controlled proxy overwrites the header on every request and direct backend access is blocked.

NGINX: use return to finish a simple redirect

Define a single-URL redirect narrowly with an exact-match location = and return. Check existing server and location precedence before adding a broad regular-expression rewrite rule.

NGINX: 301 for one page
location = /old-page/ {
  return 301 https://example.com/new-page/;
}
NGINX: preserve the method with 308 from HTTP to HTTPS
server {
  listen 80;
  server_name example.com www.example.com;

  return 308 https://example.com$request_uri;
}

For ordinary web pages, 301 is widely used. Because 308 preserves the method and body, it is a strong candidate when APIs or submission flows are involved; test the actual environment, including older clients.

PHP and CMS: a minimal example when server configuration is unavailable

Limit application-layer redirects to cases that depend on application state or where server settings cannot be changed. Set the header before output and stop execution. Never concatenate unvalidated user input into Location.

PHP: permanent redirect
<?php
header('Location: https://example.com/new-page/', true, 301);
exit;
Do not deploy 301 or 308 broadly in production as a first step. Verify Location, query strings, methods, final responses and caches in staging and with a limited set of URLs before expanding the mapping.

How to test redirects with curl, browsers and logs

A browser may reach the final page while an intermediate 302 or chain is present, POST becomes GET, or credentials are at risk of being sent to another host. Save the initial response, all hops, final state, user actions and logs separately.

Check the initial response and Location with GET

curl -I sends a HEAD request, which may not behave like GET. Also obtain response headers from a GET while discarding its body.

Check the first GET response
curl -sS -D - -o /dev/null \
  'https://old.example.com/path?ref=test'

Check every hop, the final URL and the redirect count

Follow redirects and summarize the result
curl -sS -L --max-redirs 10 -o /dev/null \
  -w 'final_url=%{url_effective}\nstatus=%{http_code}\nredirects=%{num_redirects}\n' \
  'https://old.example.com/path'

As a rule, expect one redirect, the mapped final URL and a successful final response such as 200. If the maximum redirect count is reached, investigate loops, cycles or unnecessary normalization.

Use staging and test credentials for POST and API tests

Trace a POST method and body
curl -sS -v -L --max-redirs 5 \
  -H 'Content-Type: application/json' \
  --data '{"test":true}' \
  'https://staging.example.com/old-endpoint'

When curl follows a POST with -L, it normally changes to GET after 301, 302 and 303, but resends the same method after 307 and 308.--post301 can force different behavior, but that is a client setting and does not replace selecting an appropriate server status code.

Raw HTTP responses

Status, Location, Cache-Control, Vary, cookies, canonical host, encoding and query string.

Browser actions

Chrome, Edge, Safari, back, refresh, bookmarks, login, forms, payments and downloads.

APIs and webhooks

Method, body, Content-Type, Authorization, cookies, signatures, CORS, timeouts and retries.

Crawling and logs

Every mapping row, 3xx, 404, 5xx, external hosts, hop counts, Search Console and sitemaps.

--location-trusted should not be used casually. It can send credentials or cookies across redirected hosts, so use it only when you fully control the test and every destination.

Removing redirects, rollback and caches

For a temporary redirect, set its end time and owner at the start. Permanent redirects also need a recovery plan that can restore the configuration, internal links and search signals together after an error or unexpected effect.

1

Preserve evidence and stop further changes

Record the time, URL, every status and Location, response headers, browser, logs and the preceding diff. Do not layer on another redirect before understanding the cause.

2

Restore the responsible layer to a known state

Disable the new rule at the CDN, load balancer, web server or application layer that owns the decision, and reload after checking syntax.

3

Invalidate only affected cache entries

Avoid purging the entire CDN; target affected URLs. Since a server cannot fully clear a browser's cached 301 or 308, also test a fresh profile, a private window and unused URLs.

4

Restore internal links and search signals to the same recovery version

If canonical, hreflang, sitemaps, structured data or internal links changed, restore them with the redirect as one change.

5

Retest using the same URL map and test cases

Recheck the first response, all hops, final status, GET, POST and API flows, key actions and logs. Record the cause, impact, remaining caches and prevention steps.

301 and 308 responses can be cached, so removing the configuration may not restore the old URL immediately. Search-result URLs and canonical selection also require recrawling and reprocessing. Limited prelaunch tests and a rollback plan are the most effective safeguards.

Redirect checklist before and after launch

Completion means another person can reproduce the results; merely opening the page in a browser is not enough.

Design

  • A reason, permanence, end conditions and owner are recorded.
  • Each old URL maps to a final URL or 404/410.
  • Method, body, query, cookie and credential handling are defined.
  • Exceptions, rule order, responsible layers and recovery configuration are documented.
  • The new URL serves the purpose of the old URL.

Implementation

  • Each old URL reaches its final URL in one hop where practical.
  • Exact matches and exceptions are evaluated before broad rules.
  • CDN and web-server rules are not duplicated.
  • External input is not concatenated directly into Location.
  • Syntax checks, diffs, reloads and recovery commands are saved.

Verification

  • The initial status and Location were checked with GET.
  • All hops, the final URL, status and redirect count were recorded.
  • POST, API and webhook methods and bodies were tested safely.
  • Key actions were checked in Chrome, Edge, Safari and mobile.
  • Logs show no loops, unintended external redirects, 404s or 5xx responses.

SEO and postlaunch

  • Internal links, canonical, hreflang and structured data were updated.
  • The new sitemap was submitted and old URLs are monitored.
  • Search Console procedures for a domain move were checked.
  • Temporary redirects have an end date and permanent redirects have an owner.
  • Redirects can generally be retained for at least one year, or longer if needed.

Primary sources and update policy as of July 29, 2026

HTTP specifications, search engines, web servers and test tools change. Check the official documentation and configuration-validation commands for your deployed versions as well. We reviewed the following on July 29, 2026.

Google Search Central

HTTP standard

Web servers

Testing tool

  • curl manual: covers --location, --max-redirs and POST behavior after 301/302/303 versus 307/308.
Finite Field

Finite Field editorial policyWe prioritize Google Search Central for search behavior, RFCs for status-code semantics, each web server's official documentation for configuration and the curl manual for test behavior. When an interface or specification changes, we update the review date and text.

Frequently asked questions about redirects

Should I use 301 or 308?

Both signal a permanent move. 301 is widely used for ordinary GET pages. If POST, API or webhook requests must retain the method and body after redirecting, consider 308 and test your clients.

Is the difference between 302 and 307 about security?

No. Both are temporary redirects, but a client must not change the method when automatically following 307. Some clients change POST to GET after 302, so verify the requirements for submission flows.

When should I use 303?

Use it in Post/Redirect/Get after a form or order POST to retrieve a result page with GET. This helps prevent duplicate submissions on refresh; success, failure and retry handling still need separate design.

Can all removed pages redirect to the home page?

Do not redirect them all when no equivalent replacement exists. A destination that does not match the user's purpose can confuse visitors and may be treated as a soft 404 by Google. Return 404 or 410 when there is no replacement, and offer search or relevant links on the error page.

How many redirects can a chain contain?

Prefer one hop from the old URL to the final destination. Googlebot can follow multiple hops, but Google recommends direct redirects and advises keeping unavoidable chains ideally to three or fewer and fewer than five.

How long should 301 or 308 redirects remain after a site move?

Google generally advises keeping them for at least one year. For permanent moves, keeping them as long as practical is safer for external links, bookmarks and older documents.

Is a successful curl -I enough to finish testing?

No. -I sends HEAD, which may not match GET or POST behavior. As appropriate, check the first response, every hop, final response, GET, POST and APIs, authentication, cookies, key browser actions and logs.

Does removing a 301 immediately restore the old URL?

Browsers or intermediate caches may retain a 301 or 308, so a visitor may continue to see the old redirect after the server setting is reverted. Restore the owning layer's rules, CDN cache, internal links, canonical, hreflang and sitemap to the same recovery version, then retest in a new session.

Good redirects depend on mapping and testing, not just a status code

Decide permanence, method and body preservation, and whether the final URL serves the same purpose. Redirect old URLs directly to their final destinations and align internal links, canonical, hreflang and sitemaps. Test GET and POST separately before launch, then monitor logs and Search Console.

Assign an end date for temporary redirects and an owner and recovery path for permanent ones. Because 301 and 308 effects can persist in caches and search processing, include limited testing and rollback rather than assuming a change can simply be undone later.

FINITE FIELD WEB PRODUCTION

Discuss website production that accounts for SEO and URL migration with Finite Field

New sites, redesigns, WordPress changes, localization and server moves: Finite Field plans URL design, content structure, canonical and hreflang, 301 mapping, DNS and SSL, forms and postlaunch monitoring together with visual design.

Website production WordPress changes SEO design URL and domain moves Server migration Postlaunch maintenance
  • Assess migration risks in existing URLs, search traffic, internal links and technical architecture.
  • Design information and interfaces that people can navigate and search engines can understand.
  • Document redirects, DNS and SSL, forms, measurement, rollback and postlaunch checks.
PROJECT CONSULTATION

Discuss website production, SEO and migration together

Tell us about your current site, goals and challenges. We will explain an appropriate scope, approach and estimated cost. An inquiry does not commit you to a contract.

Your current site URLs, desired launch date and required features help us provide more specific guidance.