Use a 301 when a page or domain is moving for good: it transfers ranking signals to the new URL and tells browsers to stop asking for the old one. Use a 302 when the move is temporary: a test, a maintenance window, a short promo, since it keeps the original URL indexed and leaves the door open to switch back. When you're not sure how permanent the change is, default to a 301 and confirm the switch with a header check.
TL;DR:
- Use a 301 redirect for permanent URL changes, such as domain migrations or protocol upgrades, and keep it in place for at least a year to ensure proper search engine processing.
- Deploy a 302 redirect only for temporary moves, like seasonal promotions or testing, and switch it to a 301 once the change becomes permanent to avoid traffic and ranking issues.
- 307 and 308 redirects preserve the original HTTP method, making them essential for form submissions or API calls, while 301 and 302 do not guarantee this behavior.
- Always verify redirects in production by inspecting response headers and caching behavior, especially for cached 301 responses that can hinder rollbacks.
- Avoid redirect chains, document each redirect’s purpose, and regularly audit your setup to prevent SEO damage and ensure a smooth migration process.
Table of Contents
- 301 vs 302 Redirect: What Each One Actually Means
- 301 vs 302 Redirect: When the Temporary Option Wins
- Where 307 and 308 Fit Into the Picture
- How Search Engines Actually Handle Redirect Signals
- Caching Behavior You Need to Verify Before Launch
- Setting Up Redirects on Nginx, Apache, and Beyond
- Best Practices That Prevent Redirect Disasters
- Verifying Redirects Actually Work After You Ship Them
- What I've Learned Watching Redirects Go Wrong
- Pingfloat's Tools for Managing Redirects Without the Guesswork
- Sources
301 vs 302 Redirect: What Each One Actually Means
A 301 tells browsers and crawlers "Moved Permanently." That single status code carries a lot of weight: it's the signal Google Search Central points to when you want a URL change reflected in search results, because server-side permanent redirects tell crawlers reliably that the move is final. Once Google trusts that signal, it starts folding the old page's ranking authority into the new destination.
You'll reach for a 301 in a handful of recurring situations:
- Domain migrations (moving from an old domain to a new one)
- Protocol upgrades (HTTP to HTTPS)
- Canonicalization (www vs non-www, trailing slash cleanup)
- Page consolidation (merging two thin pages into one stronger one)
Pro Tip: Don't rip out a 301 the week after launch just because rankings haven't moved yet. Search Engine Journal recommends keeping 301s in place for at least a year so search engines have time to fully process the change and stragglers using old links or bookmarks don't hit a dead end.
301 vs 302 Redirect: When the Temporary Option Wins
A 302 status code means "Found," and in practice that translates to "this is temporary, check back later." The distinction matters because search engines generally keep the original URL indexed when they see a 302, rather than replacing it with the destination in search results.
That's exactly the behavior you want for:
- A/B tests where you're routing a slice of traffic to a variant page
- Short-term promotions or seasonal landing pages
- Maintenance windows where the real page comes back in hours or days
The trap is leaving a 302 in place long after the situation stopped being temporary. If your "test" redirect has been live for eight months, search engines are still treating the destination as unproven, and it won't inherit the ranking power sitting on the original URL. That's the single most common way sites accidentally sabotage a redesign.
Pro Tip: If you catch yourself asking "is this still temporary?" more than once, it isn't. Switch it to a 301 the moment the decision becomes permanent, don't wait for a quarterly audit to catch it.
Where 307 and 308 Fit Into the Picture
301 and 302 have quieter siblings that matter more than most developers realize: 307 and 308. Both preserve the original HTTP request method, something 301 and 302 don't strictly guarantee.
- 307 (Temporary Redirect): functions like a 302, but a POST request stays a POST at the destination instead of silently becoming a GET.
- 308 (Permanent Redirect): functions like a 301, with the same method-preservation guarantee.
That distinction is trivial for a blog post redirect and critical for an API endpoint or a form submission. Ahrefs recommends 307/308 specifically when a redirect sits in the path of a POST request or API call, since losing the method mid-redirect can silently break a checkout flow or a webhook integration. If your migration touches anything that submits data, check whether 307/308 fits before defaulting to 301/302 out of habit.
How Search Engines Actually Handle Redirect Signals
Here's the mechanical difference that drives every SEO decision about redirects: a 301 signals a permanent move and generally transfers ranking authority to the destination, while a 302 signals a temporary move and search engines usually leave the original URL indexed. That's not a minor technicality. It's the entire reason picking the wrong status code during a migration can cost months of recovered rankings.
The propagation isn't instant. Expect a gradual shift as crawlers revisit the redirected URLs, reassess the destination, and update their index. During that window:
- The old URL's authority doesn't vanish, it migrates gradually as re-crawls happen
- The new URL climbs slowly rather than inheriting rank overnight
- A 302 used for a permanent change stalls that process indefinitely, because search engines have no reason to reassign authority to something they still consider a temporary detour
If you launched a redesign with a 302 and now realize the new pages are permanent, the fix is straightforward: switch every one of those redirects to a 301, then monitor rankings over the following weeks. Don't switch back and forth once you commit. Flip-flopping between 301 and 302 on the same URL confuses crawlers about your actual intent, and that confusion shows up as delayed or inconsistent indexing.
Keep the 301s in place. A year is the commonly cited minimum before removing a permanent redirect, long enough for search engines to fully process the change and for any lingering inbound links, bookmarks, or cached references to catch up.
Caching Behavior You Need to Verify Before Launch
Redirects don't just get processed by search engines, they get cached by browsers, and that caching is where rollback plans quietly fall apart — understanding common proxy error codes explained can also help diagnose unexpected redirect or caching problems. Browsers often cache 301 responses more aggressively than 302s, which is exactly the behavior you want when the move is permanent and exactly the behavior that bites you if you need to reverse it.
Three headers control what actually happens:
- Cache-Control sets how long a client is allowed to cache the redirect response before rechecking
- Expires is the older, less flexible cousin of Cache-Control, still honored by some clients
- Vary tells caches when a different response should be served based on request headers
Pro Tip: Before rolling back a 301, test from a completely fresh browser session or an incognito window. A cached redirect can keep sending real visitors to the old URL long after your server has stopped saying so.
Setting Up Redirects on Nginx, Apache, and Beyond
Server-side redirects beat meta refresh or JavaScript redirects for one simple reason: Google's own guidance favors server-side signaling because it's unambiguous for crawlers, where client-side methods depend on the browser actually executing a script or honoring a meta tag before the redirect fires.
A redirect that depends on JavaScript running successfully in every browser and every crawler is a redirect that will occasionally fail silently, exactly when you need it most.
Here's a practical sequence for setting one up correctly:
- On Nginx, a permanent redirect looks like
return 301 https://example.com/new-path;inside the relevantlocationblock, keeping capture groups intact if you're mapping multiple old paths. - On Apache,
mod_rewritehandles pattern-based redirects (RewriteRule ^old-page$ /new-page [R=301,L]), whilemod_aliascovers simpler one-to-one mappings withRedirect 301. - For temporary cases, swap
301for302(Nginx) orR=302(Apache), never mix the two on the same rule set. - Reserve meta refresh or JavaScript redirects for edge cases where server config genuinely isn't available, and treat them as a fallback, not a default.
Tools like Pingfloat's redirect rule generator produce these Nginx and Apache snippets automatically, which cuts down on the regex mistakes that cause redirect chains in the first place.
Best Practices That Prevent Redirect Disasters
Most redirect problems trace back to the same handful of habits. Fix these and you'll avoid the majority of SEO damage that comes from careless migrations.
- Never redirect a batch of unrelated deleted pages to your homepage. That pattern produces soft 404 signals and tells search engines your homepage is a dumping ground rather than a relevant destination. If content is genuinely gone with no replacement, return a proper 404 or 410 instead.
- Map old URLs directly to their new equivalents. Avoid chains where URL A redirects to B, which redirects to C. Every extra hop adds latency and dilutes the signal search engines are trying to follow.
- Document why each redirect exists and set an expiration date for anything temporary, so a "quick fix" 302 doesn't quietly live in your config for three years.
Pro Tip: Run a redirect audit every quarter during active migrations, and at least twice a year afterward. Chains creep back in as pages get restructured, and nobody notices until traffic drops.
Verifying Redirects Actually Work After You Ship Them
Configuring a redirect is the easy part. Confirming it behaves correctly in production is where most teams get sloppy, and it's a three-step check you can run in minutes.
- Step 1: Hit the URL directly and inspect the response status code and the
Locationheader it returns, rather than trusting your browser's final destination. - Step 2: Follow the full chain if there's more than one hop, confirm the final status code, and check the
Cache-Controlheader on each response. - Step 3: Once the migration is live, put uptime monitoring on the new destination and schedule re-checks through the transition window, not just on launch day.
| Check | What you're confirming |
|---|---|
| Status code | 301, 302, 307, or 308, matching your intent |
| Location header | Points to the correct final destination |
| Cache-Control | Won't sabotage a rollback if you need one |
| Uptime on destination | New URL stays reachable during the transition |
Pingfloat's response headers inspector shows the raw status code, Location header, and caching directives for any URL without needing dev tools open, which makes this a five-minute check instead of a debugging session.
What I've Learned Watching Redirects Go Wrong
The damage almost never comes from picking 301 instead of 302, or the reverse. It comes from nobody documenting which redirects were meant to be temporary, so they never get revisited or cleaned up. Conservative defaults help: when genuinely unsure, a 301 with a written expiration note beats an undocumented 302 that quietly lives for years. Build the audit into your migration checklist before launch, not after something breaks.
— Andreas
Pingfloat's Tools for Managing Redirects Without the Guesswork
Getting a redirect right on paper and confirming it actually works in production are two different problems, and the second one is where teams lose time. Pingfloat's response headers inspector shows you the live status code, Location header, and caching directives for any URL in seconds, free, with no account required.

Pair that with the redirect rule generator for Nginx and Apache syntax that's actually correct on the first try, and the uptime monitor to make sure your new destination stays reachable through the whole migration window. All three are free to use, which matters when you're checking dozens of redirect rules across a large migration and don't want to justify a tool budget for it. Run your next redirect through the response headers inspector before you call the migration done.
