Check 05.03 · HTTP and redirects

Use 302/307 for temporary moves

Keep 302 and 307 redirects for truly temporary detours, configure them on your server, CDN or CMS, and spot the ones that should be 301s.

Priority
Critical
Difficulty
Intermediate
Estimated time
30 min to 2 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

A temporary redirect (302 Found or 307 Temporary Redirect) sends the visitor elsewhere while telling search engines that the original URL is still the right one. It is meant for temporary detours: A/B tests, seasonal pages, restricted access. This check consists of using it in those cases only, configuring it correctly and converting into 301s every “temporary” redirect that is in fact permanent.

Why it matters

Google documents two opposite behaviors:

  • 301 and 308: a strong signal that the target should become canonical. The new URL is shown in the results.
  • 302, 303 and 307: a weak signal. Google normally keeps showing the source URL, but the target may be indexed in its place if other canonicalization signals point that way (internal links, sitemap, canonical).

Bing recommends the same split: 301 for a permanent move, 302 for a short-term change.

Mistakes go both ways. A 302 left in place for a permanent move keeps the old URL in the index and delays the consolidation of signals on the new one. Conversely, a 301 used for a temporary detour makes the original URL disappear from the results, and browsers remember it: when you remove the redirect, some visitors keep being sent to the target.

302 and 307 have the same effect for Google. The 307 requires the browser to keep the HTTP method (a POST stays a POST); the 302 allows it to switch to GET. The 303 explicitly forces the switch to GET: it is the right code after a form submission.

What it improves

  • Index stability The original URL keeps its place during the detour.
  • Return to normal Removing a 302 is enough to restore the situation, with no long-lived browser cache to fight.
  • Signal consolidation When fake 302s are replaced with 301s, the new URL more clearly takes over the indexing and the links.
  • Rankings No direct effect; the point is to send search engines the right message.

How to check

List the site's temporary redirects:

curl -s -o /dev/null -w "%{http_code} %{redirect_url}\n" https://www.example.com/promo/

302 or 307 is compliant if the detour is temporary. For each temporary redirect you find, ask two questions: will the original page come back? How soon? If the answer is “no” or “we don't know”, you need a 301.

In Screaming Frog, filter the Response Codes tab on Redirection (3xx) and sort by code: 302s and 307s stand out with their target. In Search Console, the URL Inspection tool shows whether Google has chosen the original URL or the target as canonical.

Good to know: in Chrome's developer tools, a “307 Internal Redirect” line to HTTPS does not come from the server. It is the browser applying your HSTS policy on its own. Crawlers do not see it; test with curl to find out the real response.

How to implement

Before you start

Choose the code according to the situation:

Situation Appropriate response
A/B test that sends some visitors to another URL 302, with a canonical to the original URL on the variant
Seasonal page or promotion that temporarily replaces a page 302 to the temporary page
Members-only page, sending visitors to the login page 302 or 303 to /connexion, original page not indexable
After a form is submitted 303 to the confirmation page
Root / that directs to /fr/ or /en/ 302 and hreflang="x-default" on the root, or better, a selection page with no forced redirect
Maintenance of the site or of a section 503 with Retry-After, no redirect
Product temporarily out of stock 200 on the product page, with availability displayed
Permanent move 301 or 308

For A/B tests, Google asks for 302 redirects and for the whole setup to be removed as soon as the test ends. It advises against redirecting automatically based on the visitor's presumed language. See avoid forced redirects based on browser language (opens in a new tab) and use 503 during temporary maintenance (opens in a new tab).

Record each temporary redirect with its planned end date, in a shared table:

Original URL Target Code Reason Planned end Owner
/soldes/ /soldes-hiver/ 302 Seasonal campaign 2027-02-15 Marketing
/tarifs/ /tarifs-b/ 302 A/B test 2026-12-20 Product

Apache

Versions Apache 2.4.

RedirectMatch 302 ^/soldes/?$ https://www.example.com/soldes-hiver/
RedirectMatch 307 ^/api/panier$ https://www.example.com/api/v2/panier

With mod_rewrite, [R] without a code already returns 302, but write it explicitly:

RewriteEngine On
RewriteRule ^soldes/?$ https://www.example.com/soldes-hiver/ [R=302,L]

Reload with sudo apachectl configtest && sudo systemctl reload apache2, or simply save the .htaccess file.

Nginx

Versions Nginx 1.18 and later.

location = /soldes/ {
    return 302 https://www.example.com/soldes-hiver/;
}

With rewrite, the redirect flag returns 302 and permanent returns 301. For a 307, use return 307 …;. Reload with sudo nginx -t && sudo systemctl reload nginx.

LiteSpeed

Versions LiteSpeed Web Server 6.x, OpenLiteSpeed 1.7 and later.

RewriteRule [R=302,L] rules in .htaccess work as is. On OpenLiteSpeed, enable “Auto Load from .htaccess” and do a graceful restart after every rule you add or remove.

Caddy

Versions Caddy 2.

redir returns 302 by default; specify it for readability:

example.com {
    redir /soldes/ /soldes-hiver/ temporary
    redir /api/panier /api/v2/panier 307
}

IIS

Versions IIS 10, URL Rewrite module 2.1.

In the URL Rewrite rule in web.config, redirectType="Found" returns 302 and redirectType="Temporary" returns 307:

<rule name="Soldes" stopProcessing="true">
  <match url="^soldes/?$" />
  <action type="Redirect" url="https://www.example.com/soldes-hiver/" redirectType="Found" />
</rule>

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

From the Rules overview, Create rule > Redirect Rule, choose the 302 or 307 status code. The default code offered is 301: change it. A temporary rule can be disabled in one click at the end of the campaign, with no redeployment. A Redirect Rule applies to every matching request: an A/B test that redirects only some visitors requires application logic or a Worker.

AWS

Versions CloudFront, S3, Elastic Load Balancing and Amplify Hosting consoles, November 2026.

  • CloudFront: in a CloudFront Function, statusCode: 302 and statusDescription: 'Found'.
  • Application Load Balancer: “Redirect to URL” action with the HTTP_302 code.
  • S3 static website: HttpRedirectCode set to 302 in the redirection rules.
  • Amplify Hosting: type 302 in rewrites and redirects.

Plesk

Versions Plesk Obsidian 18.0.

Use the .htaccess file from the Apache section, or the “Additional nginx directives” in Apache & nginx Settings with a return 302 block.

cPanel

Versions cPanel & WHM 110 and later, Jupiter theme.

In Domains > Redirects, choose “Temporary (302)”. Delete the redirect from the same screen at the end of the campaign.

Shared hosting

The .htaccess file from the Apache section works with most hosting providers. Put the rule at the top of the file and record it in the tracking table: it is the kind of rule people forget to remove.

Vercel

Versions vercel.json on Vercel, all plans, November 2026.

{
  "redirects": [
    { "source": "/soldes", "destination": "/soldes-hiver", "permanent": false }
  ]
}

permanent: false returns 307; for a 302, use "statusCode": 302. With neither property, the redirect is permanent.

Netlify

Versions _redirects file on Netlify, all plans, November 2026.

/soldes   /soldes-hiver   302

Netlify documents 302 for temporary redirects and does not support 307 in _redirects.

WordPress

Versions WordPress 6.4 to 7.1; Redirection 5.x and Rank Math plugins.

The Redirection plugin and Rank Math's redirections module let you choose 302 or 307 when you create the rule. Check the plugin's default code: some offer 301, others 302. wp_redirect() returns 302 by default, and wp_safe_redirect( $url, 302 ) in a theme or a plugin lets you specify it.

Shopify

Versions Shopify admin, all plans, November 2026.

Shopify's URL redirects are permanent: the admin does not offer temporary redirects. For a temporary campaign, change the page content or the menu link instead, or use a dedicated app.

Squarespace

Versions Squarespace 7.0 and 7.1, all plans, November 2026.

In “URL Mappings”, replace 301 with 302 at the end of the line: /soldes -> /soldes-hiver 302.

Laravel

Versions Laravel 10 to 13.

Route::redirect() returns 302 by default:

Route::redirect('/soldes', '/soldes-hiver');
Route::redirect('/api/panier', '/api/v2/panier', 307);

In a controller, redirect()->route('login') returns 302; this is what the auth middleware does for protected pages.

Next.js

Versions Next.js 14 to 16.

With the App Router, redirect() returns 307 in a server component or a route handler, and 303 after a Server Action submitted without JavaScript. With the Pages Router, getServerSideProps returns { redirect: { destination: '/soldes-hiver', permanent: false } }, which is a 307. In next.config.js, which applies to both, permanent: false returns 307:

module.exports = {
  async redirects() {
    return [{ source: '/soldes', destination: '/soldes-hiver', permanent: false }];
  },
};

Common mistakes

  • Keeping a 302 for a permanent change: this is the most common case, often because the tool offers 302 by default (Route::redirect(), Caddy's redir, wp_redirect()).
  • Using a 301 for a one-off campaign: browsers remember it and keep redirecting after it has been removed.
  • Redirecting during maintenance: a 302 to an “under construction” page gets that page indexed; the right response is 503.
  • Redirecting crawlers differently from visitors: serving one URL to Googlebot and another to humans is cloaking, test or not.
  • Leaving an A/B test in place after it ends: Google states that a prolonged test may be interpreted as an attempt to deceive.
  • Redirecting based on IP address or browser language with no alternative: Googlebot mostly crawls from the United States and sends no Accept-Language header, so it only sees one version.

Frequently asked questions

When should I use a 302 redirect rather than a 301?

Use a 302 redirect when the original page is meant to come back: A/B test, seasonal promotion, detour to a login page. It tells search engines that the original URL is still the right one. As soon as a move is permanent, or you do not know when it will end, switch to a 301: the new URL will then become canonical and take over the old one's signals.

Does a 302 redirect pass on SEO value?

A 302 redirect tells Google that the original URL remains the reference: that is the URL it normally keeps showing, and the target is not treated as canonical. If the 302 stays in place for a long time and other signals, such as internal links or the sitemap, point to the target, Google may end up indexing the target. For a permanent move, a 301 avoids this ambiguity.

What is the difference between a 302 and a 307 redirect?

For search engines, none: Google treats the 307 like a 302. The difference concerns the HTTP method. With a 307, the browser must resend the same request, so a POST stays a POST; with a 302, it may turn it into a GET. The 307 therefore suits APIs and forms, the 302 standard pages.

Why does Chrome show a 307 redirect that my server does not send?

The “307 Internal Redirect” label in Chrome's developer tools corresponds to the automatic switch to HTTPS enforced by HSTS. The browser has remembered that the site requires HTTPS and rewrites the URL before even sending the request. Crawlers do not see this redirect; to find out the server's real response, test the URL over HTTP with curl.

Updated on

Topic checklist (PDF)

And now?

In the “HTTP and redirects” topic

  1. Check that active pages return 200
  2. Use 301/308 for permanent moves
  3. Use 302/307 for temporary moves
  4. Fix redirect chains
  5. Fix redirect loops
  6. Fix broken internal links
  7. Fix broken external links
  8. Create a helpful 404 page
  9. Return 404/410 for removed content with no equivalent
  10. Avoid redirecting all removed pages to the homepage
  11. Fix unjustified 403s
  12. Fix excessive 429s
  13. Fix 5xx errors
  14. Monitor server errors
  15. Use 503 during temporary maintenance