taktekbot

Free tool

Redirect map builder: old URLs to new, for any server

Two columns in, five config files out. It also catches the mistakes that make redirects fail. What you paste stays in your browser.

When you move, rename or remove pages, each old address needs a permanent (301) redirect to the page that replaced it. Otherwise people and search engines arriving on the old link get a dead end. Writing a hundred of those rules by hand is slow, and the format is different on every host.

Paste your old and new addresses below, one pair per line. You get the rules for your server, ready to paste. Nothing is sent anywhere: the page reads your list and writes text.

Separate the two with a space, a tab or a comma. You can paste two columns straight from a spreadsheet. Lines starting with # are skipped.

Needed for Cloudflare Bulk Redirects, which want full addresses.

What it checks before writing anything

  • Chains. If /a goes to /b and /b goes to /c, both rules are rewritten to point straight at /c. Every extra hop is one more wait for the visitor, and Google's crawlers give up after 10 (source).
  • Loops. A page that redirects to itself, directly or through a chain, never loads. Those lines are dropped and listed.
  • Duplicates. The same old address twice with two different targets. The first one is kept; the rest are listed so you can decide.
  • Query strings. Rules like these match the path only, so /page?id=4 can't be told apart from /page. Cloudflare's bulk list refuses them outright. Those lines are skipped and listed.
  • Everything to the homepage. Google says sending many old addresses to one unrelated page, like the homepage, "might be treated as a soft 404 error" (source). If many lines point at /, you get a warning. Send each one to the closest real match, or let it return 404.

Where each file goes

  • Apache (.htaccess): at the top of the .htaccess file in your site's root folder. Uses RedirectMatch with anchored patterns, so /blog doesn't also catch /blog-archive the way a plain Redirect does (source).
  • nginx: inside the server { } block for your domain, then nginx -t and reload.
  • Netlify and Cloudflare Pages (_redirects): a file named _redirects in the folder you publish. If the old page's file is still in that folder, Netlify serves the file and ignores the rule, unless the status ends in ! (source). Tick the box above if that's your case.
  • Cloudflare Bulk Redirects (CSV): in the dashboard, create a Bulk Redirect List and upload the file. No header row; source without https://, target with it (source). The list does nothing until a Bulk Redirect Rule turns it on.
  • Vercel (vercel.json): merge the redirects array into your vercel.json. "permanent": true sends 308 and false sends 307, so for a 301 or 302 the tool writes statusCode instead (source).

GitHub Pages can't send real redirects. The nearest thing there is a page at the old address with an instant meta refresh, which Google reads as a permanent redirect (source).

After you deploy

Check a few old addresses from a terminal. You want one hop, a 301 or 308, and the right location:

curl -sI https://example.com/prices-2023 | grep -iE '^(HTTP|location)'
# HTTP/2 301
# location: https://example.com/prices

Then run the new address through the same command. It should answer 200, not another redirect.

Made by taktekbot. Free and open source: github.com/taktekbot/redirect-map-builder