sfw/fix
Multiple redirects medium

Avoid multiple page redirects

A page fires two or more redirect hops before the final document loads, adding a round-trip of latency per hop.

What you see

PageSpeed Insights / Lighthouse:
"Avoid multiple page redirects — Potential savings of 380 ms"
http://example.com/ → https://example.com/ → https://www.example.com/ → https://www.example.com/page/

What’s actually happening

The address you requested isn't the one that finally renders. Open DevTools Network, tick "Preserve log," load the URL, and you'll see a stack of 301/302 rows each handing off to the next via a Location header before the real 200 arrives. TTFB looks inflated because the clock starts at the first request, not the last. On a cold mobile connection each hop is its own DNS/TLS/round-trip, so a 4-link chain can cost 600ms+ before a single byte of HTML comes back.

Common causes

  • Stacked rules that each fix one thing: one redirect forces HTTPS, a second adds (or strips) www, a third appends a trailing slash — instead of one rule going straight to the canonical form.
  • Links and sitemaps point at the http:// or non-www version, so every visit starts at the back of the chain.
  • A CDN/proxy redirect layered on top of an origin-server redirect (e.g. Cloudflare "Always Use HTTPS" plus an .htaccess HTTPS rule).
  • Legacy mobile redirects (m.example.com) bouncing through the desktop URL first.
  • CMS or framework canonical-URL settings disagreeing with the web-server config, so each corrects the other's output.

How to fix it

  1. Map the actual chainRun curl -sIL http://example.com/ and read every "location:" line in order. That's your hop list — fix it, don't guess.
  2. Collapse to a single hopWrite one rule that jumps from any entry form straight to the final canonical URL. In Apache, order matters: rewrite to https AND www AND trailing-slash in one RewriteRule with the [L,R=301] flags, not three separate rules that fire in sequence.
  3. Make 301s permanent and cacheableUse 301 (not 302) for canonical redirects so browsers and Google cache the destination and skip the hop on repeat visits. Confirm no Cache-Control: no-store is sent on the redirect response.
  4. Fix the sources, not just the serverUpdate internal links, the XML sitemap, and canonical tags to the final URL so most traffic never enters the chain at all. A redirect you never trigger costs nothing.
  5. Retire stacked proxy rulesIf a CDN already forces HTTPS, remove the duplicate origin rule (or vice versa) so the two layers stop adding hops on top of each other.

Stop it recurring

Pick one canonical URL form (scheme + host + trailing-slash convention) up front and make every link, sitemap entry, and redirect target that exact string.

Related errors