A redirect sends browsers and crawlers from one URL to another using a 3xx status and a destination, so people land on the right page.
You click a link, the page loads, and you never notice anything odd. That smooth feeling is often a redirect doing its job. Redirects keep old URLs from turning into dead ends after a rename, a redesign, an HTTPS move, or a platform switch.
Still, redirects can go sideways. One wrong rule can slow pages, trap users in loops, or split search signals across multiple URLs. So let’s break down what a redirect is at the protocol level, what the common codes mean, and how to set them up without making a mess.
How Does Redirect Work? In Plain HTTP Terms
At the HTTP layer, a redirect is a server response that tells the client, “The thing you asked for lives at a different address.” The server returns a 3xx status code plus a destination URL in the response headers. Most of the time, the browser follows that destination right away, then renders the final page.
Here’s the simplest flow:
- Your browser requests
/old-page. - The server replies with a 3xx status and a
Locationheader pointing to/new-page. - The browser requests
/new-page. - The server replies with a normal 200 response, and the page renders.
That’s it. No magic. Just one request that gets told to try another URL. The part that trips people up is that not all 3xx codes carry the same meaning, and clients do not all treat them the same way in edge cases.
What A Redirect Changes And What It Keeps
A redirect changes the address the client ends up using. It does not “move” the content by itself. Your content still lives where your server (or app) serves it. A redirect is a signpost.
Redirects can preserve or change details of the request, depending on the code and the client:
- Method: GET, POST, and others can be preserved or rewritten in some cases.
- Body: A form submission body may be resent or dropped depending on redirect type.
- Headers: Some headers carry over, some are stripped for safety when crossing origins.
- Caching: A redirect may be cached, which can make “undoing” a bad rule feel stubborn.
From a site-owner view, the redirect is a promise you’re making to browsers and crawlers about where the canonical content lives now. If the promise keeps changing, crawlers can get cautious and users can get stuck with stale redirects in cache.
Redirect Types You’ll See In Real Sites
Redirects show up in more places than people expect. If you’ve ever turned on HTTPS, removed “www,” changed a trailing slash rule, or merged duplicate pages, you’ve met them.
Server-Side Redirects
These are sent by the server in the HTTP response. They’re the most common and the most predictable. You set them in places like Nginx, Apache, a CDN edge rule, a load balancer, or your app framework.
Client-Side Redirects
These happen after the browser loads a page and runs code. Common cases include JavaScript that changes window.location, or a meta refresh tag. They can work, yet they add delay and can behave differently across clients. For most URL moves, stick with server-side rules.
Platform-Level Redirects
CMS and e-commerce tools often add redirect layers. WordPress plugins, Shopify URL handles, and reverse proxies can create redirects you never wrote by hand. That’s handy, but it can lead to stacked rules and long chains if you don’t keep track.
Choosing The Right Status Code
The status code signals intent. That intent affects caching, how clients repeat the request, and how search engines treat the move over time.
301 Moved Permanently
Use 301 when the old URL is not coming back. It’s the classic “this page has moved” response. Browsers and caches often remember it for a while. That’s great when the move is final, and rough when you made a typo.
302 Found
Use 302 when the move is temporary. Think short-lived tests or a brief maintenance detour. Over time, search engines can still treat a long-running 302 like a permanent move if it keeps behaving like one, so don’t leave “temporary” redirects running for months without a reason.
307 Temporary Redirect
307 is a clearer temporary redirect for cases where the request method should be preserved. If a client sent a POST, it should repeat a POST to the destination. That makes it safer for some app flows.
308 Permanent Redirect
308 is the permanent sibling to 307. It signals a permanent move while keeping the original request method intact. It’s useful when you’re redirecting endpoints that may receive non-GET requests.
If you want the official framing of redirect intent in search systems, Google’s documentation is worth reading once and bookmarking: Google Search Central redirect guidance.
On the protocol side, redirects rely on the Location header to point to the destination. MDN’s reference is a clean, practical description of how that header fits into redirect responses: MDN Location header reference.
How Redirects Work For URL Changes And Search Signals
Search engines treat redirects as a signal that the destination URL should be treated as the main version of the content. That’s the whole point when you change URLs: you want people to land correctly, and you want search systems to update what they show in results.
Redirects can help consolidate signals from links, internal references, and indexing history. Still, the neat outcome depends on execution. A single clean hop from old to new is what you want. Extra hops cost time and can muddy the message.
Keep in mind that redirects don’t replace good internal linking. If your site still links to the old URL, users and crawlers keep hitting redirects, and that wastes crawl and adds latency. Update internal links as part of the same change.
Common Redirect Patterns That Keep Things Clean
Most redirect work is boring in a good way. You’re trying to make URL behavior predictable, with no surprises.
One-To-One Page Moves
If /docs/widget-setup becomes /docs/widget-install, map the old page straight to the new page with a single permanent redirect. Avoid routing through a category page, then to the final page. One hop is the goal.
HTTP To HTTPS
When you move to HTTPS, redirect every HTTP request to the HTTPS version of the same URL path. Do it at the edge or server layer so the redirect happens before your app code runs, which cuts load and avoids mixed-rule drift.
Non-WWW To WWW (Or The Other Way)
Pick one canonical host and redirect the other. This keeps URLs consistent for users, analytics, and caching layers.
Trailing Slash Rules
Decide whether directories end with a slash and stick to that rule. If your router treats /blog and /blog/ as different, you can end up with duplicate pages or redirect ping-pong. Set one canonical form and redirect the other.
Removing Index Files
If you have URLs like /about/index.html, redirect them to /about/. Then, make sure internal links use the canonical form so the redirect becomes a safety net rather than daily traffic.
Redirect Pitfalls That Break User Flow
When redirects go wrong, they tend to fail in a handful of predictable ways. Fixing them is usually a matter of spotting the pattern, then simplifying.
Redirect Chains
A chain is multiple hops before the final 200 page. A chain can happen when you redirect A → B, then later redirect B → C, then later redirect C → D. Users still land on D, but each hop adds a request and more time.
Redirect Loops
A loop is when the destination points back to something earlier in the path. Browsers stop after a limit and show an error. Loops often come from conflicting rules: a trailing slash redirect colliding with an HTTP-to-HTTPS redirect, or host rules fighting each other.
Broad Pattern Rules That Catch Too Much
Wildcard redirects can be handy, yet they can swallow valid URLs if the pattern is too loose. A common mistake is redirecting an entire directory to one page, which creates a pile of unrelated URLs that all land on the same destination. That feels wrong to users and confuses crawlers.
Redirecting To The Wrong Canonical
Redirects should land on a page that answers the same intent. If an old product page redirects to a generic category page with no close match, users bounce. If the old content still has a clear successor, redirect to that successor.
Redirect Status Codes Compared
The table below gives a fast way to choose a code based on intent, caching, and method handling. Use it as a sanity check before you ship rules.
| Status Code | When To Use It | Client Behavior Notes |
|---|---|---|
| 301 | Permanent URL move for pages and assets | Often cached; some clients may rewrite non-GET to GET in legacy cases |
| 302 | Temporary reroute during tests or brief detours | May be cached for short periods; historically can rewrite methods in some clients |
| 303 | After a POST, send the user to a page they can safely refresh | Forces the next request to be GET, which avoids resubmitting forms |
| 307 | Temporary move where method must stay the same | Preserves method and body; safer for API flows |
| 308 | Permanent move where method must stay the same | Preserves method and body; useful for API endpoints and strict routing |
| Meta Refresh | Last-resort redirect when you can’t change server responses | Runs after HTML loads; adds delay and can behave inconsistently |
| JavaScript Redirect | App-driven routing inside single-page apps | Depends on JS running; can fail for bots and some clients |
| Refresh Header | Rare legacy setups | Not a standard redirect pattern for modern sites |
How To Implement Redirects Without Surprises
You can implement redirects in a few layers. The best place depends on how your site is hosted and where the URL logic lives.
At The Edge Or CDN
If you use a CDN, edge redirects run close to the user and can be faster than hitting origin servers. This is a good spot for host normalization, HTTP-to-HTTPS, and a small set of path moves that rarely change.
In The Web Server
Nginx and Apache rules are classic for redirects. This layer is good when you want predictable behavior before the request reaches app code. It’s also a good place for rules that cover many URLs in a structured way, like a whole section moving under a new prefix.
In The Application
App-level redirects make sense when the destination depends on database state, user locale, or feature flags. This is common in frameworks like Next.js, Django, Rails, and Laravel. The trade-off is overhead: the app has to run before it can respond with the redirect.
In WordPress
WordPress can handle redirects through plugins or custom code. Plugins are convenient, yet they can stack rules over time. If you use plugins, keep a small log of what you added and remove old rules that are no longer needed, so you don’t pile up chains.
How To Test A Redirect Like A Pro
You don’t need a lab. You need a repeatable check that catches the common failure modes.
Check The First Response
Use your browser dev tools Network panel, or a command-line request, and look at the first response. Confirm:
- The status code is the one you intended.
- The
Locationheader points to the exact destination you want. - The destination returns 200 (or another expected final response).
Count The Hops
Follow the redirect chain and count how many requests occur before the final page. If you see more than one hop for a planned move, you’ve likely stacked rules.
Test Variations Of The URL
Try:
- HTTP and HTTPS
- www and non-www
- with and without trailing slash
- uppercase vs lowercase paths, if your server treats them differently
- query strings, if you use them for tracking
This is where loops show up. If one variation lands on a loop, the rules are fighting each other.
Redirect Troubleshooting Checklist
When you see redirect errors in browsers, performance regressions, or odd crawl stats, walk through this checklist and you’ll usually find the culprit fast.
| Symptom | Likely Cause | What To Check |
|---|---|---|
| Browser shows “too many redirects” | Loop between two rules | Host, HTTPS, and trailing slash rules colliding |
| Old URL takes long to load | Redirect chain with multiple hops | Map the old URL straight to the final destination |
| Some pages redirect, others 404 | Missing one-to-one mappings | List old URLs with traffic and add direct rules for them |
| Users land on a generic page | Over-broad wildcard rule | Rule pattern catches unrelated paths |
| API calls fail after redirect | Method rewritten by redirect type | Try 307/308 when method must stay the same |
| Changes don’t seem to apply | Redirect cached in browser or edge | Test in a private window and clear CDN cache if needed |
| Tracking parameters disappear | Destination rules drop query strings | Confirm query passthrough in server or edge config |
| Mobile and desktop behave differently | Device-based routing rules | Remove device sniffing redirects unless required |
Redirect Hygiene For Growing Sites
Redirects tend to accumulate. A site that’s been around for years often carries old migrations, old naming patterns, and forgotten plugin rules. That doesn’t mean you need a purge. It means you need a little housekeeping.
Keep A Redirect Log
Track what changed, when it changed, and why. A simple spreadsheet works. The goal is speed: when something breaks, you can spot the last rule that touched the affected path.
Prefer Direct Mappings Over Chains
If you already redirect A → B and you now want B → C, update the rules so A → C. Then remove the extra hop. That improves load time and keeps your intent clear.
Update Internal Links During The Same Release
Redirects are a safety net, not the primary way to route normal navigation. Update your menus, in-content links, canonical tags, XML sitemaps, and hreflang (if you use it) so they point to the final URLs.
Watch For Accidental Duplicate URLs
Mixed slash rules, mixed casing, and mixed hostnames can split a single page into multiple addresses. Redirect everything toward one canonical form so analytics, caching, and crawling all line up.
When Redirects Are The Wrong Tool
Redirects solve URL moves. They don’t solve content mismatches or broken architecture choices. Here are cases where you should stop and rethink:
- Mass redirecting many unrelated URLs to one page. Users feel tricked, and crawlers get confusing signals.
- Using redirects to hide soft 404s where the destination page has no matching content.
- Redirecting logged-out users to login pages for public URLs that should stay public.
- Redirecting to different pages by user agent unless you have a clear technical reason.
If the content is gone with no replacement, a clean 404 or 410 can be the honest answer. Redirect only when there’s a real successor page that matches what the user tried to reach.
A Practical Way To Think About Redirects
Redirects are promises about identity: “This old address now points to that new address.” When you keep the promise consistent, browsers cache it cleanly, crawlers update their records, and users stop seeing broken links.
When you break the promise—by changing destinations often, stacking rules, or sending unrelated pages to a single catch-all—you pay with slower loads, odd errors, and messy indexing signals. Keep it simple, keep it direct, and treat each redirect as a small contract you intend to honor.
References & Sources
- Google Search Central.“Redirects and Google Search.”Explains how Google interprets redirects and when different redirect types make sense for crawling and indexing.
- MDN Web Docs.“Location header – HTTP.”Defines the Location response header and how it’s used with 3xx redirect responses.
