Fix redirect chains and loops

A redirect chain adds latency and leaks crawl signals. Point each legacy URL directly at the final destination, use 301 or 308 for permanent moves, and keep the map in source control. Audit with curl -IL and update internal links so chains stop growing.

highIn codeimpact effort

Why this matters

Every legacy URL should reach its final 200 in a single hop.

Get the full breakdown

The extended brief explains when this works, when it does not, and the trade-offs. Join the waitlist and it unlocks for every tip when sign-in opens; MCP access is the paid part.

Join the waitlist

Before you start

  • Access to redirect configuration or middleware

How to apply it

  1. Map the current chains General best practice

    Run curl -IL on a sample of legacy URLs and record each Location header. A chain is present when more than one 3xx appears before the 200.

    Check: The audit output contains the full hop list for every sampled legacy URL.

  2. Rewrite rules to point at the final target

    Replace intermediate hops with a direct rule to the final URL. Use 301 or 308 for permanent moves. Exclude destination paths from broad pattern rules to prevent loops.

    Check: curl -IL your production domain/legacy-url shows exactly one 301 or 308 followed by 200.

  3. Update internal links to the destination General best practice

    Find internal links that still point at redirected URLs and update the href to the final target. This prevents the chain from reappearing after the next edit.

    Check: A site crawl reports zero internal links whose target returns a 3xx.

Get the prompt for your agent

A ready-to-paste prompt for your agent that implements this tip and verifies the result in your repo.

Join the waitlist

Source: seo-mcp playbook · curated entry · report an error

Framework notes

nextjs-app

Define permanent rules in `next.config.ts` under `async redirects()` with `permanent: true`; use `permanentRedirect()` for runtime cases.

wordpress

Use the Redirection plugin or `wp_redirect($url, 301)` in `template_redirect`; check that no plugin adds a second hop after yours.

shopify

Create URL redirects in the admin under Navigation, and remove redirects that point at another redirect; Shopify does not chain automatically for you.

Official references

Let your agent apply this + 161 more tips.

Pre-order — $19