Independent software, built & maintained by PRBLEM.
28 releases 21 free · 7 professional STORE / 2.41.0
PRBLEMindependent software
Home Field Notes Web Infrastructure
Web Infrastructure FIELD NOTE

HTTP 301 Is Not Always Good: The Hidden Cost of Redirect Chains

A redirect can be correct in isolation and still be part of a bad route. Trace the whole chain, not one response.

PRBLEM — XenForo add-ons, WordPress plugins and software tools FIELD NOTE // 9007

A 301 Moved Permanently response is not a problem by
itself.

It is often exactly what you want.

The problem appears when several individually reasonable redirect
rules combine into a route nobody designed intentionally.

A common chain

Consider this request:

http://example.com/products/widget

It may pass through several layers:

1. HTTP -> HTTPS
2. non-www -> www
3. add trailing slash
4. language redirect
5. old slug -> new slug
6. final 200 response

The browser eventually reaches the page, so the setup can appear
healthy.

But each hop costs another request/response cycle and introduces
another place for configuration to disagree.

Redirects can come
from different layers

This is why chains are common.

A redirect can be produced by:

  • web server configuration;
  • reverse proxy;
  • CDN;
  • WordPress core canonical redirects;
  • a redirect plugin;
  • an SEO plugin;
  • application code;
  • a localization plugin;
  • an upstream load balancer.

Each layer can be correct according to its own configuration and
still create a bad combined result.

Status codes
matter, but route shape matters too

Common redirect codes include:

  • 301 — permanent redirect;
  • 302 — temporary redirect;
  • 307 — temporary redirect preserving method
    semantics;
  • 308 — permanent redirect preserving method
    semantics.

For a simple GET, users often focus only on permanent versus
temporary behavior.

For non-GET requests, method preservation can be operationally
important.

Do not “normalize” status codes casually without understanding
request methods and client behavior.

Why chains cost performance

Each hop may require:

  • network round trip;
  • TLS work if the host changes;
  • DNS lookup if the hostname changes;
  • server processing;
  • cookie handling;
  • cache evaluation.

Modern connections reduce some cost, but zero redirects is still
cheaper than four.

On mobile or high-latency networks the difference becomes more
visible.

Loops are
configuration disagreement made visible

A redirect loop often means two layers disagree about canonical
state.

Example:

Proxy rule:
example.com -> www.example.com

WordPress/plugin rule:
www.example.com -> example.com

The client bounces forever.

Scheme detection behind a reverse proxy can create similar problems
if WordPress believes the request is HTTP while the visitor is actually
using HTTPS externally.

Trace, do not guess

The fastest diagnostic is the whole response chain.

With curl:

curl -I http://example.com/old-page

To follow redirects while showing useful detail:

curl -IL http://example.com/old-page

Look at each Location header and status.

Do not test only the final URL. The original entry point is where the
unwanted chain begins.

Same-site
redirect tools should have SSRF boundaries

A web-based redirect checker can become a server-side request forgery
primitive if it accepts arbitrary URLs and lets the server fetch private
network targets.

A safer admin diagnostic can restrict checks to the site’s own
origin.

For example:

  • require the same host as WordPress;
  • reject private/alternate targets if not needed;
  • stop following when a redirect leaves the site;
  • display the external destination without fetching it.

That is often enough for diagnosing a site’s own redirect
configuration.

The canonicalization trap

You may have independent rules for:

  • HTTP/HTTPS;
  • www/non-www;
  • trailing slash;
  • uppercase/lowercase path;
  • index file removal;
  • language prefix.

The best route applies canonicalization as directly as possible.

Instead of:

A -> B -> C -> D

prefer:

A -> D
B -> D
C -> D

where practical.

Changing a slug or permalink structure can introduce
application-level redirects on top of web server rules.

Before adding a plugin redirect, test whether WordPress or the server
already performs one.

Duplicate layers are a common source of chains.

CDN migrations deserve
a redirect audit

Moving behind a CDN or proxy can change:

  • scheme detection;
  • host headers;
  • canonical host enforcement;
  • cache behavior.

After the change, trace representative URLs:

http://domain/
https://domain/
http://www.domain/
https://www.domain/
old high-traffic URL
login/admin URL

The goal is not “all of these redirect.” The goal is “all
non-canonical forms reach the canonical form in the fewest justified
hops.”

Redirects and monitoring

A simple uptime monitor may follow redirects automatically and report
only the final 200.

That can hide a growing chain.

For important entry points, record:

  • initial status;
  • hop count;
  • final URL;
  • total duration;
  • whether scheme/host changed unexpectedly.

This catches routing drift before it becomes a loop.

A practical rule

Redirects are part of routing logic, not decorative SEO
configuration.

Treat them like code:

  1. define canonical destination;
  2. trace current behavior;
  3. remove redundant hops;
  4. test method-sensitive routes;
  5. retest after CDN, proxy or permalink changes.

A 301 can be correct.

Four correct 301s in a row can still describe a route
worth fixing.