PRACTICAL GUIDE

How to Test 301 Redirects After a Website Rebuild

Test old URLs before a website migration. Follow the Location header, catch redirect chains and confirm Cloudflare Worker routes actually apply your redirect rules.

THE SHORT ANSWER

Start from real old URLs and inspect the first response without following it. Verify the final page, canonical and query behavior. When a Worker serves the old path itself, test that code path alongside the asset redirect rules.

To test a redirect after a rebuild, request the old URL without following redirects first. Confirm it returns a permanent redirect to the intended new URL, then request the destination and check that it returns the right page.

A browser that lands on the right page can hide extra hops. A redirect rule in a file can also be bypassed by the code that handles the request.

I tested both failures in a local Cloudflare Workers setup. The chained rule hid a second hop. A separate matching rule never ran because the Worker answered first.

Map old URLs before touching the rules

Start with the old sitemap, real inbound links or a list of pages people still use. Map each URL to the closest replacement.

If a page has been removed and there is no relevant replacement, use a real 404 or 410. Sending unrelated pages to the homepage makes the visitor start over and can be treated as a soft 404. Google’s site migration guide

Write the final HTTPS destination in the map, including its intended trailing slash. Keep query handling explicit.

For example, decide whether a newsletter’s tracking parameter should survive and whether an obsolete internal query should be dropped. Test the parameter the way people actually use it.

Read the first hop before following the chain

Use a GET request and print the response headers. Replace the example host with your preview or production host.

curl -sS -D - -o /dev/null 'https://example.com/old?from=newsletter'
curl -sS -L -o /dev/null -w '%{http_code} %{num_redirects} %{url_effective}\n' 'https://example.com/old?from=newsletter'

The first command exposes the initial Location and status. The second tells you where the chain ends and how many redirects it followed. I use the first result to fix the rule and the second to make sure the journey still works.

In my Wrangler 4.148.0 fixture, /old?from=newsletter returned 301 to /middle?from=newsletter, which returned another 301 to /new/?from=newsletter.

A direct rule for /old-direct reached that same final page in one hop. Both variants preserved the query in this fixture, and the destination returned the new page with a 200.

Local requests showed two redirects for /old, one redirect and a final 200 for /old-direct, and an early Worker response of 200 without a Location header on /worker-old.

Local Cloudflare Workers · same query on each request. Observed November 13, 2026.

If the destination redirects again to add a slash, change the first rule to the canonical path. A permanent redirect such as 301 or 308 communicates a lasting move. Check the redirect type your host actually emits. Google’s redirect guidance

Google Search Central documentation explains that 301 and 308 are permanent server-side redirects.

Official documentation: Google Search Central — permanent server-side redirects. Screenshot captured November 23, 2026; shown as source guidance, not a migration test.

If the old URL returns 200, find which code served it

For Workers static assets, Cloudflare documents _redirects in the static asset directory. Place it where your build will include it. An existing Worker that returns its own response can bypass these rules. Cloudflare Workers redirects

Specify the status code. Cloudflare defaults to 302 when it is omitted. For a lasting move, write the intended 301 in the rule and verify the actual response.

I included /worker-old /new/ 301 in the fixture and configured the Worker to run first. That Worker returned a plain-text 200 for /worker-old. The response had no Location header even though the rule matched the pathname.

Check whether the old path reaches the asset handler. If the Worker owns the path, implement the redirect in that handler or move the rule to the layer that will see the request first. Keep the target on an approved host and preserve only the parameters you intend to carry.

Decide when the migration check passes

Use three real legacy URLs first. Include one with a tracking parameter, one with a trailing-slash variant and one whose old content was removed.

For each moved URL, save the initial status and destination, the hop count and a sample of the final page text.

The final page should use its own canonical and appear in the sitemap. Update your own navigation and links to point directly to it.

For the removed page, confirm the requested address returns the planned 404 or 410. Use the SEO launch checklist for the remaining discovery checks.

Sources & scope

Capabilities are based on these official sources. Recommendations are editorial judgments. Hands-on scope: Read-only HTTP checks against a local Cloudflare Workers static-assets fixture using Wrangler 4.148.0 and compatibility date 2026-10-07. No edge caching, migration traffic or indexing tested.

Keep exploring