Why a Domain Migration Halved the Traffic
Platform defaults are usually 302 — a temporary borrow. Search engines keep the old address's equity where it was, the old domain stops receiving visits, and the rankings go with it.
One chain covers the choice: permanent with method preserved → 308, permanent → 301, temporary with method preserved → 307, temporary → 302, and POST that should become a GET → 303.
Four Status Codes: Semantics, Caching, Method
| Status | Name | Semantics | Cached? | Method change |
|---|---|---|---|---|
| 301 | Moved Permanently | permanent | Yes (browser + SEO) | POST→GET |
| 302 | Found | temporary | No | legacy POST→GET |
| 303 | See Other | view with GET | No | intentional to GET |
| 307 | Temporary Redirect | temporary, keep method | No | keep method |
| 308 | Permanent Redirect | permanent, keep method | Yes | keep method |
Two details that cost people the most:
- 301/308 are cached. Once a browser remembers the mapping, later visits to the old URL go straight to the new one, and a server-side change cannot reach clients that already cached it. That makes 301 right for a committed migration and wrong for a grey release; a rollback will not cover users who already stored the redirect.
- 301/302 rewrite POST into GET. Early clients treated any redirect as "send it again as GET", so the request body disappeared. 307/308 exist precisely to remove that ambiguity: the client must repeat the original method and body.
Form submissions and payment callbacks hit the second point hardest. If the response is 301/302, the backend never receives the body and the order fields vanish. Either return 307 so the method is replayed, or return 303 to state clearly that the result page is fetched with GET — 303 is a deliberate conversion, not a loss.
The Location Header and Chains
The response header carries the target, and the client reads Location to pick the next hop:
HTTP/1.1 301 Moved Permanently
Location: https://new.example.com/path/to/page
- A relative
Locationresolves against the current URL, so a relative path on a domain move lands back on the old host; - every extra hop costs another round trip, and a cross-host hop also pays a fresh DNS lookup and TLS handshake — far more than a same-host hop;
- browsers and crawlers follow to the end, but give up with an error beyond roughly 20 hops;
- point at the final URL in one step. Chaining A→B→C means any broken link in the chain kills the whole inbound link.
SEO: Where Link Equity Transfers
The difference between 301 and 302 is not technical behaviour; it is the signal sent to search engines. The first says the old address is retired and the index should move; the second says the original still works and is merely being viewed elsewhere for now.
Three boundaries — cross one and it becomes a penalty:
- The content must be equivalent. Keeping a 301 after a rewrite that changed everything tells the engine the new page is a stand-in, and rankings drop with it.
- Map one-to-one; never send the whole site to the homepage. A pile of old URLs 301-ing to the homepage reads as a cluster of dead links, and the homepage cannot serve those long-tail intents anyway.
- Keep the 301 records and maintain them. The sitemap lists only new addresses, but deleting old URLs from the sitemap does not delete the external links pointing at them.
Cross-domain moves work the same way: a 301 is necessary, but equity only arrives if the new domain is crawled and indexed normally.
Redirect Loops: Causes and Diagnosis
A loop has exactly two shapes: A→B→A, or A pointing at itself. The cause sits in middleware, not business code:
- a trailing-slash rule firing alongside another rule;
- http↔https or www↔non-www canonicalisation running again on an already-canonical URL;
- CDN origin rules and origin-server rules overriding each other.
# print headers per hop and see which jump returns to the original host
curl -sI -L --max-redirs 10 https://old.example.com
The fix is to canonicalise in exactly one place and decide the redirect after that decision. Two rule sets each adding their own hop will always trigger each other.
Three Scenarios, Pick Directly
| Scenario | Choice | Reason |
|---|---|---|
Old pages moved under archive/, old URLs retired |
301 | Permanent semantics; equity follows the new address |
| One-day grey release of a new design, possibly rolled back | 302 or 307 | Temporary semantics; the original stays valid |
| Redirect back to a list page after form submit | 303 | Result is fetched with GET, so refresh does not resubmit |
| A create endpoint that a gateway or client may retry | 307/308 plus an idempotency key | A redirect preserves the method only; duplicate creation still needs idempotency — see REST API design |
Reproducible Results
A real 301 from this site (curl -I fetches headers only):
curl --noproxy '*' -sI http://127.0.0.1:3100/encoding-tools
HTTP/1.1 301 Moved Permanently
location: /encoding-tools.html
content-type: text/html
Read three things: the status line names 301 Moved Permanently; location is the target (curl follows it only with -L); and a 302 here would keep search engines indexing the old URL — the exact mechanism behind traffic lost to a mistyped status. Check each code's meaning in the HTTP status codes reference, and resolve targets with the URL parser.