Linkbruno

Checking redirects after a website migration

Updated 25 October 20267 min read

Check your site

Up to 25 pages and every link on them. No signup.

On this page
  1. Before launch: export every old URL
  2. Rules for the redirect map
  3. Launch day: check every old URL
  4. Crawl the new site for old links
  5. After launch: watch Search Console
  6. How long to keep the redirects

The redirects after a website migration are right when every old URL that had traffic, links or rankings answers with a 301 (or 308) straight to its closest new equivalent in one hop, nothing lands on the home page by default, and the new site's own links point at new URLs instead of leaning on the redirects. Checking that is three jobs: build the full list of old URLs before launch, run the whole list through a checker on launch day, and crawl the new site for links that still use the old structure. Then keep the redirects for at least a year.

Before launch: export every old URL

You can only check redirects for URLs you know about, and once the old site is gone, that list is hard to rebuild. Google's site-move guide suggests where to look (Google, site moves); combine all of these and remove duplicates:

  • A full crawl of the old site, including images and PDFs. Google says embedded files "need to be moved in the same way as all other content on your website."
  • Your XML sitemaps, because "it's likely your most important URLs have been submitted in Search Console that way".
  • Search Console's Links report, under External links > Top linked pages, for the URLs other sites link to (Search Console Help). Its tables are limited to 1,000 rows, so a backlink tool helps on bigger sites.
  • Landing pages from your analytics, and server logs for "URLs that were visited at least once recently".

Keep the old sitemap files too, because Google's guide has you submit them alongside the new one after the move. Also save a crawl export with each old page's title: it's what you'll match against when you build the map.

Rules for the redirect map

Put the map in a spreadsheet with two columns, old URL and new URL, and follow a few rules:

  • One hop. The old URL goes to the final new URL, with the final scheme, host and trailing slash. If the migration also moves to https or changes www, the old-path rule has to point at the final host directly, or the canonical rules add hops. Google says to avoid chaining redirects and, if you can't, to keep it "ideally no more than 3 and fewer than 5" (Google, site moves). Redirect chains shows server configs that do it in one hop.
  • Permanent redirects. Google recommends "HTTP permanent redirects if possible, such as 301 and 308."
  • The closest equivalent. Google's guide says: "Don't redirect many old URLs to one irrelevant single URL destination, such as the home page of the new site," which it warns "might be treated as a soft 404 error". See soft 404s.
  • A real 404 or 410 for pages you dropped on purpose. Google says to "make sure those URLs correctly return an HTTP 404 or 410 error response code on the new site."
  • Pattern rules for structural changes (/blog/2019/05/slug to /blog/slug), with exceptions listed above them.
Old URL Redirect to
Same page, new slug The new page
Page merged into another The page that now holds the content
Old category or section The matching new category
Discontinued product with a successor The successor
Removed, nothing comparable Nothing: return 404 or 410
Old PDF or image The file's new URL

On a hosted platform the map goes into its redirect settings, and each has a catch. Shopify imports a CSV, but it only redirects URLs that are already broken. A Webflow import replaces every redirect already on the site. Squarespace takes one rule per line in URL mappings. WordPress needs server rules or a plugin for anything but renamed posts.

Launch day: check every old URL

Ten at a time

For your most important pages, paste up to 10 old URLs into the redirect checker. It shows each hop's status code and Location, the final address, loops, chains, http hops and redirects that end on a home page. For a longer list, the bulk URL checker takes 100 at a time and shows the first and last status code of each, with a CSV to download. Both are quick for spot checks, but too slow for a map with thousands of rows.

The whole list with a script

Export the map as a CSV with old URL,expected new URL on each line and run it through curl. This script checks the first response is a permanent redirect, counts the hops, checks the final status and compares the final URL with the one you expected:

#!/usr/bin/env bash
# Usage: ./check-redirects.sh redirect-map.csv
# Each line: old URL,expected final URL
while IFS=, read -r old expected; do
  expected=${expected%
#39;\r'} # tolerate Windows line endings # First response only first=$(curl -s -o /dev/null -w '%{http_code}' "$old") # Follow every redirect: final status, number of hops, final URL read -r code hops final < <(curl -s -o /dev/null -L --max-redirs 10 \ -w '%{http_code} %{num_redirects} %{url_effective}\n' "$old") problems="" [[ $first != 301 && $first != 308 ]] && problems+="first-hop-$first " (( hops > 1 )) && problems+="chain-$hops-hops " [[ $code != 200 ]] && problems+="ends-in-$code " [[ $final != "$expected" ]] && problems+="wrong-target " [[ $final =~ ^https?://[^/]+/?$ && ! $old =~ ^https?://[^/]+/?$ ]] && problems+="home-page " printf '%s\t%s\t%s\n' "${problems:-ok}" "$old" "$final" sleep 0.5 # be gentle with your own server done < "$1"

Run it with bash check-redirects.sh map.csv > results.tsv and open the result in a spreadsheet. Each line starts with ok or a list of problems:

ok                       https://old.example.com/about          https://example.com/about/
chain-2-hops             http://old.example.com/pricing         https://example.com/pricing/
first-hop-302            https://old.example.com/contact        https://example.com/contact/
ends-in-404 wrong-target https://old.example.com/blog/hello     https://example.com/blog/helo/
wrong-target home-page   https://old.example.com/team/jane      https://example.com/

first-hop-302 means a temporary redirect slipped in; change it to 301 or 308. chain means a rule points at an address that redirects again. ends-in-404 together with wrong-target usually means a typo in a server rule; ends-in-404 alone means the new page itself is missing. home-page catches a catch-all rule, or a map row someone filled in with the home page to get it done. URLs you kept unchanged will show first-hop-200, which is fine for them.

The %{num_redirects} and %{url_effective} variables come from curl's --write-out option (curl manual). To test the new server before switching DNS, add --resolve example.com:443:203.0.113.10 (your new server's IP) to both curl commands, plus a :80: entry if the map includes http:// URLs. Google's guide suggests the same split: the URL Inspection tool for individual URLs, command-line tools or scripts for large numbers.

If you'd rather not script it, Screaming Frog's list mode does the same check with "Always Follow Redirects" turned on, and its All Redirects report shows the hop count and final URL for each row (Screaming Frog tutorial). The free version stops at 500 URLs.

The redirect map protects visitors arriving from outside. The new site's own pages are a separate problem: content imported from the old CMS keeps its old absolute URLs, and every one of those is a redirect hop at best and a 404 at worst. Google's guide: "Change the internal links on the new site from the old URLs to the new URLs."

Crawl the new site and look for:

  • Internal links that redirect, especially in navigation, footers and related-post blocks
  • Image paths from the old structure (/wp-content/uploads/... on a site that no longer runs WordPress, an old CDN host). Finding broken images covers the srcset copies too
  • http:// links to your own pages that were pasted years ago
  • Canonical tags, hreflang links and the XML sitemap still listing old URLs
  • Links to the staging or preview domain that slipped into content

If the new site is built from a repository, checking links in CI catches most of these on the preview deploy, before launch.

Linkbruno reports internal links that redirect into long chains or end at an error, http:// links on https pages and missing images, and shows where on each page the link sits (navigation, footer, main text), so you know whether one template edit fixes it. For a quick first pass, the free scan checks up to 25 pages without an account. The guide to finding broken links covers crawl settings in more detail.

After launch: watch Search Console

In the weeks after the move:

  1. Submit the new sitemap, and the old sitemaps too, as Google suggests.
  2. If the domain or subdomain changed, submit a Change of Address in Search Console for the old site. Google says you don't need it for http to https moves.
  3. Check the Page indexing report for Not found (404), Soft 404 and Redirect error. Redirects to the home page can show up as Soft 404, and chains or loops as Redirect error (Search Console Help). Fix the rows, then click Validate fix. The Search Console guide explains how to trace each URL back to the page linking to it.
  4. Keep watching after the first week. For 404s, Google notes that "Googlebot will probably continue to try this URL for some period of time", so old URLs keep turning up for a while. A 404 on its own doesn't hurt the rest of the site (do broken links affect SEO?); what you lose is the links and visits that URL still gets.
  5. Contact sites with important links to you and ask them to update the URL. Google's guide suggests this too, using the list of linking sites you saved.

How long to keep the redirects

Google's answer: "Keep the redirects for as long as possible, generally at least 1 year." Treat a year as the minimum. Backlinks, bookmarks and old emails don't expire, and a redirect rule costs almost nothing to keep, so most sites should leave them in place indefinitely. If the old domain is part of the move, keep renewing it as well: once it lapses, someone else can register it and every old link points at their site (links to expired domains).

See what’s broken on your site

The free scan reads up to 25 pages and checks every link on them. No signup.

Related