Check 44.15 · Redesign and migration

Test redirects

Test the whole redirect map before and after the switchover: test list, free curl script, Screaming Frog, reading the verdicts and fixes.

Priority
Critical
Difficulty
Intermediate
Estimated time
2 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Testing redirects means requesting every old URL in the redirect map and checking three things: the response is a permanent redirect (301 or 308), it leads to the planned destination in a single hop, and that destination returns 200. The test is run on the staging site before the switchover, then on the live site on the day itself and in the weeks that follow. The deliverable is a results file in which every row carries a verdict.

Why it matters

During a redesign or a domain change, the old URLs are the ones that Google, Bing, generative engines, backlinks and visitors' bookmarks know. Only the redirect tells them where each piece of content now lives. Google recommends server-side permanent redirects for a site move, and advises testing URLs one by one with the Search Console URL Inspection tool and large lists with command-line tools or scripts.

A well-written redirect map can fail in execution for mundane reasons:

  • a rule placed after a more general one never applies;
  • the CDN (Content Delivery Network) or the application adds a hop (HTTP to HTTPS, adding www or the trailing slash) and creates a chain;
  • the code is 302 instead of 301, because that is the tool's default;
  • URL parameters, capital letters or accented characters do not match the pattern;
  • the destination itself returns a 404 error or redirects again.

None of this shows up when browsing the new site: you have to request the old addresses.

What it improves

  • Carrying rankings over Each old URL passes its signals on to its equivalent; this is the primary success factor of a migration.
  • Crawling Fewer chains and errors, so fewer wasted requests for Googlebot and Bingbot. Google follows at most ten consecutive redirects.
  • Backlinks and AI citations External links and the sources cited by AI assistants still lead to a useful page, not to an error.
  • Visitor experience Bookmarks and links in emails and on social networks keep working.
  • Project management The results file provides a quantified, dated list of fixes instead of impressions.

How to check

For a single URL, follow the complete chain:

curl -sIL https://example.com/ancienne-page | grep -i -E "^(HTTP|location)"

Correct result:

HTTP/2 301
location: https://example.com/nouvelle-page
HTTP/2 200

After launch, the Search Console URL Inspection tool, applied to an old URL with “Test live URL”, shows that the page redirects. In the Page indexing report, the reasons “Page with redirect” (normal for old URLs) and “Redirect error” (to fix) give the overall picture.

A test passes when 100% of priority URLs and at least 98% of the whole map get the OK verdict, and the remaining gaps are explained. These thresholds are an industry convention, not a search engine rule.

How to implement

Before you start

You need the comprehensive redirect map (opens in a new tab), as a two-column CSV: old URL, expected destination. For a removed page with no equivalent, the expected destination is 410 or 404.

Test schedule:

When Target Goal
D−10 to D−2 Staging Fix the rules before the switchover
Launch day, within the hour Live site Check that the production configuration is the right one
D+1, D+7, D+30 Live site Detect regressions (deployment, cache, overwritten rule)

Step 1 — Build the test file

Test the whole map, but make sure it does include these often-forgotten categories:

Category Source Example
Pages that generate traffic or revenue Search Console and analytics export (opens in a new tab), revenue-generating pages (opens in a new tab) /plomberie/depannage-fuite
URLs that receive backlinks backlink export (opens in a new tab) /guide-2023.pdf
URLs cited by AI assistants pages cited by AI systems (opens in a new tab) /tarifs
Protocol and host variants Generated http://example.com/tarifs, https://www.example.com/tarifs
Trailing slash and capital letters Generated /Tarifs/
URLs with parameters Logs, analytics /produits?categorie=the-vert&page=2
Files Pre-redesign crawl indexed images, PDFs

Save everything in plan.csv, with no header row:

https://example.com/plomberie/depannage-fuite,https://example.com/depannage/fuite-eau/
https://example.com/tarifs,https://example.com/tarifs/
http://example.com/tarifs,https://example.com/tarifs/
https://example.com/promo-noel-2022,410

URLs must be written exactly as the server will return them: https://example.com/tarifs/ and https://example.com/tarifs are two different URLs for the test.

Step 2 — Test without waiting for the DNS switch

If the staging site has its own hostname, replace the domain in a copy of the test file. If the redirects only work under the real domain name, query the new server under that name before changing the DNS, using curl's --resolve option (the RESOLVE variable in the script below) or a line in your computer's hosts file.

If the staging site is password-protected, as it should be (see protect and audit the staging site (opens in a new tab)), pass the credentials to the script with the AUTH variable.

Step 3 — Run the curl script

This free, dependency-free script works on macOS, Linux and Windows (WSL or Git Bash). It requests each URL twice: once without following the redirect, to read the code and target of the first hop, and once following it to the end.

#!/usr/bin/env bash
# Usage: ./tester-redirections.sh plan.csv > resultats.csv
# plan.csv: old_url,expected (destination URL, or 404 / 410), no header row
set -u

ua="Mozilla/5.0 (compatible; test-redirections)"
options=(-s -o /dev/null -A "$ua" --max-time 30)

if [ -n "${AUTH:-}" ]; then
    options+=(-u "$AUTH")
fi

if [ -n "${RESOLVE:-}" ]; then
    options+=(--resolve "$RESOLVE")
fi

echo "ancienne_url,attendu,code_1er_saut,cible_1er_saut,sauts,url_finale,code_final,verdict"

while IFS=, read -r ancienne attendu; do
    ancienne="${ancienne%$'\r'}"
    attendu="${attendu%$'\r'}"

    if [ -z "$ancienne" ]; then
        continue
    fi

    premier=$(curl "${options[@]}" -w '%{http_code} %{redirect_url}' "$ancienne")
    code1="${premier%% *}"
    cible1="${premier#* }"

    final=$(curl "${options[@]}" -L --max-redirs 10 -w '%{num_redirects} %{http_code} %{url_effective}' "$ancienne")
    read -r sauts code_final url_finale <<< "$final"

    verdict="OK"

    if [ "$attendu" = "404" ] || [ "$attendu" = "410" ]; then
        if [ "$code1" != "$attendu" ]; then
            verdict="CODE_INATTENDU"
        fi
    elif [ "$code1" != "301" ] && [ "$code1" != "308" ]; then
        verdict="PAS_DE_REDIRECTION_PERMANENTE"
    elif [ "$url_finale" != "$attendu" ]; then
        verdict="MAUVAISE_DESTINATION"
    elif [ "$code_final" != "200" ]; then
        verdict="DESTINATION_EN_ERREUR"
    elif [ "$sauts" -gt 1 ]; then
        verdict="CHAINE"
    fi

    echo "$ancienne,$attendu,$code1,$cible1,$sauts,$url_finale,$code_final,$verdict"
done < "$1"

Examples of how to run it:

chmod +x tester-redirections.sh

# Live site
./tester-redirections.sh plan.csv > resultats.csv

# Password-protected staging site
AUTH="recette:motdepasse" ./tester-redirections.sh plan-preprod.csv > resultats-preprod.csv

# New server queried under the real domain, before the DNS switch
RESOLVE="example.com:443:203.0.113.10" ./tester-redirections.sh plan.csv > resultats-avant-dns.csv

# Keep only the anomalies
grep -v ",OK$" resultats.csv

The script sends requests one after the other: a few thousand URLs take from a few minutes to an hour. On a fragile server, do not parallelize it.

Step 4 — Test with Screaming Frog

Screaming Frog (free up to 500 URLs) does the same job with an interface:

  1. Configuration > Spider > Advanced: tick Always Follow Redirects, so that the tool follows each chain to its end even in list mode.
  2. For a protected staging site: Configuration > Authentication, standards-based authentication tab, then enter the credentials when prompted.
  3. Mode > List, then Upload > Paste and paste the column of old URLs.
  4. Once the crawl has finished, open Reports > Redirects > All Redirects: each row gives the starting URL, the number of hops, the final URL and its status code.
  5. Export, then compare the final URL with the expected destination in a spreadsheet, using a lookup on the old URL.

In Google Sheets or Excel, with the export in an Export tab and the map in a Plan tab (column A old URL, column B destination), the check formula for column C of the map is:

=IF(XLOOKUP(A2,Export!A:A,Export!F:F,"missing")=B2,"OK","TO CHECK")

Adjust the column letter F to that of the final URL in your export. In a French-language version of Excel, the functions are called SI and RECHERCHEX.

Step 5 — Read the verdicts and fix

Verdict Usual cause Fix
PAS_DE_REDIRECTION_PERMANENTE (no permanent redirect) with 302 or 307 Default value of the plugin or rule Switch the rule to 301 or 308: see use 301/308 for permanent moves (opens in a new tab)
PAS_DE_REDIRECTION_PERMANENTE with 404 Missing rule, pattern that does not match, rule hidden by another Add or reorder the rule
PAS_DE_REDIRECTION_PERMANENTE with 200 The old URL still exists on the new site (test page, duplicate) Remove the duplicate or redirect
MAUVAISE_DESTINATION (wrong destination) Typo, overly broad generic rule, redirect to the homepage Fix the target: see avoid redirecting all removed pages to the homepage (opens in a new tab)
DESTINATION_EN_ERREUR (destination in error) New page not published, slug changed since the map was made Publish the page or update the map
CHAINE (chain) Separate HTTPS or www hop, trailing slash added by the application Rewrite the rule to target the final URL: see fix redirect chains (opens in a new tab)
CODE_INATTENDU (unexpected code) on a URL expected to return 410 Removed page that redirects anyway See return 404/410 for removed content (opens in a new tab)
Code 000 Timeout, invalid certificate, blocked by the firewall Test the URL by hand, check the certificate and the security rules

Fix in batches, then run the script again on the complete file, not just on the fixed rows: a new rule can break another one.

Cloudflare

Versions Cloudflare dashboard, all plans, November 2026.

Redirect Rules, Bulk Redirects and Workers only apply to traffic that goes through Cloudflare. A test with --resolve pointing to the origin server's IP address bypasses them: it only shows the server's redirects. To test Cloudflare rules before the switchover, test under the real domain name once the DNS record is proxied (orange cloud), or on a proxied test subdomain carrying the same rules. Bulk redirect lists are managed in Bulk Redirects; after a change, wait for it to propagate, then run the script again.

WordPress

Versions WordPress 6.4 and later.

The Redirection plugin lets you set the code for each rule: check that it is set to 301. Its 404 error log (Tools > Redirection, 404s tab) is a complementary source after launch: any URL that appears there often is an old address missing from the map. If a page cache is active (plugin or host), clear it before each round of tests: a page cached before the rule was created can hide the redirect.

Shopify

Versions Shopify admin, all plans, November 2026.

A Shopify URL redirect only applies if the old address no longer matches any existing page in the store. A PAS_DE_REDIRECTION_PERMANENTE verdict with a 200 code therefore often means that a product, collection or page still uses the old URL handle. Shopify also adds its own prefixes (/products/, /collections/, /pages/): write the expected destination with these prefixes in the test file.

Common mistakes

  • Testing a sample of ten URLs: errors hide in rare patterns (parameters, capital letters, old sections). Test the whole map every time.
  • Following redirects without reading the first hop: curl -L on its own shows 200 even if the first hop is a 302 or the chain has three steps.
  • Testing with a browser: it caches 301s and hides fixes. Use curl or a cleared private window.
  • Forgetting the http:// and www variants: old backlinks often point to them and produce chains.
  • Accepting a redirect to the homepage as a success: Google may treat it as a soft 404; either the page has no equivalent or the map is incomplete.
  • Testing staging with its own configuration: if production goes through a different CDN, server or set of rules, run the full test again on the live site on launch day.
  • Stopping on launch day: a plugin update, a deployment or a purge of rules can break everything a week later. Schedule D+1, D+7 and D+30.

Frequently asked questions

How many URLs should you test after a redesign?

Test every URL in the redirect map, not a sample. Errors concentrate on rare cases: old sections, URLs with parameters, capital letters, http or non-www variants. A curl script tests several thousand addresses in under an hour, and Screaming Frog does it in list mode. Aim for 100% success on priority pages and explain every remaining gap.

Should a migration use a 301 or a 308 redirect?

Both are suitable for a permanent move: Google treats them the same way and passes signals on to the new URL. A 308 also guarantees that the request method is not changed, which matters for forms or APIs. Avoid 302 and 307, on the other hand: they are temporary, and plugins and CDNs often apply them by default.

Can you test redirects before changing the DNS?

Yes. With curl, the --resolve option sends the request to the new server while using the real domain name, without touching the public DNS. A line in your computer's hosts file has the same effect for the browser and crawlers. Be careful: the rules of a CDN such as Cloudflare do not apply in this case, because the request reaches the origin server directly.

Why does a redirect work in the browser but not for Google?

The browser caches 301 redirects: it can display the right destination even though the server returns something else. A rule can also depend on a cookie, on a language, or on a JavaScript redirect that Googlebot does not follow in the same way. Always test with curl, without cookies, then confirm with the Search Console URL Inspection tool.

Updated on

Topic checklist (PDF)

And now?

In the “Redesign and migration” topic

  1. Crawl the site before the redesign
  2. Export URLs and metadata
  3. Export Search Console and analytics data
  4. Export backlinks
  5. Identify revenue-generating pages
  6. Identify pages cited by AI systems
  7. Identify strategic pages to preserve
  8. Keep high-performing URLs if possible
  9. Create a comprehensive redirect map
  10. Map old URLs to relevant equivalents
  11. Preserve strategic content and internal links
  12. Preserve structured data, entity identifiers and important anchors
  13. Protect and audit the staging site
  14. Test performance before launch
  15. Test redirects
  16. Check canonicals, hreflang, sitemaps and robots.txt
  17. Remove indexing blocks on the live site
  18. Check tracking
  19. Submit new sitemaps
  20. Use Google's Change of Address tool if applicable
  21. Crawl the site after launch
  22. Monitor critical errors daily
  23. Monitor rankings, traffic and AI citations
  24. Keep redirects for at least a year, ideally longer
  25. Prepare a rollback plan