How to Build a 301 Redirect Map for a Redesign or Migration, With a Test Script
Written by Usama Afzal, founder and director · Published
A redirect map is a two-column list that says where every old address on your site should send visitors and search engines after a redesign or migration. Build it from data, not memory, match each old page to its closest new page, flatten any chains, and test the result before and after launch. This guide gives a step-by-step method and a small script you can run yourself. Google and Shopify documents were read on 11 November 2026.
When do you need a redirect map?
You need one whenever an address that people or search engines already know will stop working or move. Typical triggers are a platform change (WordPress to Shopify, Wix to WordPress), a new URL structure, a domain change, merging two sites, or deleting a batch of old pages. If a redesign keeps every URL exactly as it was, you do not need a map, and that is the safest redesign there is. Ask your designer to keep addresses unchanged wherever the page still exists.
Without a map, old addresses return errors. Visitors land on a dead page, and search engines lose the link between the old address and the new one. Google's guidance for site moves is blunt: map each old URL to its new destination, use server-side permanent redirects, and test them. Our checks before a redesign explain why a redesign is not always the answer, and the website redesign service page describes how we plan the keep, change, merge or remove decision around it.
Step 1: Collect every old URL you know about
Google's site-move guidance says to build the list of old URLs from several places rather than one, and to include images, videos, JavaScript and CSS files as well as pages. Pull from all of these and merge them into one sheet, removing duplicates:
- Your XML sitemap. Good for pages you want indexed, but often incomplete.
- A crawl of the live site. A desktop crawler finds pages the sitemap forgot and shows each page's status code.
- Search Console. The pages and queries that actually earn impressions and clicks. Export them before you change anything.
- Analytics. Landing pages that bring visitors, including old ones nobody links to any more.
- Server logs. Addresses that are still requested, including images and files other sites link to.
- Your CMS. An export of pages, posts, products and categories with their current addresses.
Also record which of these URLs have backlinks, if you have a source for that. A page with outside links deserves the closest possible match, because those links are the part you cannot rebuild by yourself.
Step 2: Give every URL a fate
Do not map blindly row by row. Decide first what happens to each old URL. There are only four honest options.
| Fate | When it applies | What you do |
|---|---|---|
| Stays the same | The page exists in the new site at the same address | No redirect. Check it returns 200 on the new site |
| Moves | The same content now lives at a new address | One 301 straight to the new address |
| Merged | Several thin pages are folded into one stronger page | 301 each old address to that page, if the topic really is the same |
| Removed | No equivalent exists and the page has no traffic or links | Let it return 404 or 410. Google's guidance is to return 404 or 410 for old content you are not moving |
The "removed" row is the one people avoid, and it is the one that protects you from the common mistake of sending hundreds of unrelated old pages to the home page. Google's guidance says not to send many unrelated old URLs to one page such as the home page. A redirect should mean "this content moved here". If it did not, an honest error page is better than a misleading redirect.
Step 3: Lay out the spreadsheet
Two columns are enough for the file that goes to your developer: old URL and new URL. Keep a few more for yourself so the sheet can be reviewed and tested later.
| old_url | new_url | fate | why | priority | tested |
|---|---|---|---|---|---|
| /about-us.html | /about | moves | Same content, new address | High | |
| /blog/2019/05/seo-tips | /blog/seo-tips | moves | Date folders dropped | Medium | |
| /product-category/shoes | /collections/shoes | moves | Shop platform changed | High | |
| /spring-sale-2021 | (none) | removed | Expired offer, no links | Low |
These rows are invented to show the layout, not taken from a real client. Priority is yours to define. A simple rule is high for pages with organic traffic, backlinks or sales, medium for pages with a few visits, low for the rest. Work through high priority first, and do not leave the sheet half finished at launch.
Step 4: Watch for the edge cases
Most redirect problems after a launch come from a small set of patterns that a row-by-row map does not show.
- Chains. If A goes to B and B goes to C, change A to go straight to C. Google's guidance says to redirect straight to the final destination and avoid long chains.
- Loops. A sends to B and B sends back to A. The page never loads. Test for this explicitly.
- Trailing slashes, case and www.
/pricingand/pricing/can be different addresses. So can http and https, and www and non-www. Decide the standard version and map from every variant that is live today. - Query strings. Tracking parameters such as
?utm_source=usually should not need their own rows, but filter and pagination parameters might. Check what your crawl shows. - Pagination and filters. Page 2, 3 and so on of a list rarely have equivalents. Redirect the page with real content and let the rest return an error.
- Images, PDFs and downloads. If other sites link to a file, it counts as an address worth mapping.
- Language folders. If you serve more than one language, map each version to its own counterpart, not all to one.
The free 301 redirect map builder turns a list of old and new pairs into rules for Apache, Nginx, Netlify or a CSV, and warns about duplicates, loops and chains before you publish. It runs in your browser, so the list stays on your machine.
Step 5: Put the redirects live
Google recommends server-side redirects wherever possible, and names permanent redirect codes 301 and 308 for moves you will not reverse. JavaScript redirects are a last resort, because Google renders JavaScript after crawling and may never see the redirect. How you apply them depends on the platform:
- Apache.
Redirect permanentorRewriteRulewith[R=301]in the server configuration or.htaccessfile. - Nginx.
return 301in the server block. - Shopify. Shopify's help centre describes redirects under Content, then Menus, then URL redirects, with a CSV import. Two limits matter. A store can have at most 100,000 URL redirects. And redirects only work on broken URLs: if the old address still loads a valid page, the redirect will not apply. That second point catches migrations where an old collection or page was recreated with the same address.
- WordPress. Either server rules or a redirect plugin. Prefer server rules for large lists, because a plugin can add a database lookup to requests.
Moving to Shopify? Our Shopify migration service page covers the crawl, import and cutover steps around the map, and our WooCommerce or Shopify guide covers whether to move at all.
Step 6: Test every row, before and after launch
A redirect that exists is not the same as a redirect that works. For each row you want to know four things: the first response is a 301 or 308, there is only one hop, the final address matches the sheet, and the final status is 200. Google suggests checking with the URL Inspection tool or scripts. The script below does the scripted version using only Python's standard library. Save it as check_redirects.py.
import csv, sys, time, urllib.error, urllib.parse, urllib.request
class NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, *args, **kwargs):
return None # stop at the first response so we can count hops
opener = urllib.request.build_opener(NoRedirect)
def one_hop(url):
req = urllib.request.Request(url, method="HEAD", headers={"User-Agent": "redirect-check/1.0"})
try:
return opener.open(req, timeout=20).status, None
except urllib.error.HTTPError as e:
return e.code, e.headers.get("Location")
def follow(url, limit=6):
chain = []
for _ in range(limit):
code, location = one_hop(url)
chain.append(code)
if code in (301, 302, 303, 307, 308) and location:
url = urllib.parse.urljoin(url, location)
else:
break
return chain, url
with open(sys.argv[1], newline="", encoding="utf-8") as f:
for row in csv.DictReader(f):
chain, final = follow(row["old_url"])
problems = []
if chain[0] not in (301, 308):
problems.append("first response is %s, not 301 or 308" % chain[0])
if len(chain) > 2:
problems.append("%d redirects in a chain" % (len(chain) - 1))
if final.rstrip("/") != row["new_url"].rstrip("/"):
problems.append("lands on " + final)
if chain[-1] != 200:
problems.append("final status %s" % chain[-1])
print(("OK " if not problems else "FIX ") + row["old_url"] + " -> " + final + " " + "; ".join(problems))
time.sleep(1) # be polite to your own server
Put your pairs in a CSV with the headers old_url,new_url, using full addresses, then run python check_redirects.py map.csv. We ran it against two real redirects on our own site on 11 November 2026, plus a third row where we deliberately gave the wrong expected destination:
OK https://websiteprism.com/our-blog/ -> https://websiteprism.com/our-blog
OK https://websiteprism.com/our-services/ -> https://websiteprism.com/our-services
FIX https://websiteprism.com/our-services/ -> https://websiteprism.com/our-services lands on https://websiteprism.com/our-services
The first two lines show a trailing-slash address sending a single 301 to the standard version. The last line shows what a mismatch looks like. Some servers refuse HEAD requests. If you see 405 responses, change "HEAD" to "GET" in the script. Run it against a staging copy first if your host can apply the rules there, then again on launch day against the live site.
Step 7: Monitor for a few weeks, and keep the redirects for a year or more
Google tells site owners to expect temporary ranking fluctuation during a move, and says medium-sized sites may need a few weeks or more before the new URLs show. After launch:
- Submit the new sitemap in Search Console, and remove the old one if the address changed.
- Watch the page indexing and sitemap reports. Old addresses should fall away as the new ones appear.
- Re-crawl the old URL list and check every row returns one 301 to a live page.
- Update internal links, so pages stop pointing at addresses that now need a redirect.
- Keep the redirects for at least a year. Google's guidance says so, and users may benefit from keeping them indefinitely.
- If you change a Shopify redirect later, remember that browsers and search engines cache 301 responses. Removing one does not take effect everywhere at once.
The website launch checklist includes these post-launch checks in a tailored list. If a migration is large or the old site has years of history, the technical SEO audit is a reasonable way to find what the crawl alone will not show.
Planning a redesign or a platform move?
Send us your site address and what you plan to change. We reply with questions and a written quotation, and the redirect plan is part of the scope.
Get a written quote →Frequently asked questions
Should I use a 301 or a 302 redirect?
Use 301 or 308 for a move you will not reverse. Google treats permanent redirects as a signal that the new address should be the one shown in results. A 302 or 307 says the move is temporary, so the old address tends to stay.
Can I redirect everything to the home page?
You can, but you should not. Google's guidance says not to send many unrelated old URLs to one page such as the home page. Send each page to its closest equivalent, and let pages with no equivalent return 404 or 410.
How many redirects can a map have?
That depends on the platform. Shopify states a maximum of 100,000 URL redirects per store. On your own server the limit is practical: very long lists are better written as pattern rules than as one line per page.
How long do I keep redirects?
At least a year, according to Google's site-move guidance. Keeping them longer costs little and helps people arriving from old links.
Do redirects lose ranking?
A correctly mapped migration can still see temporary movement, which Google says to expect. A redirect to an unrelated page, a chain, or a missing redirect is what turns movement into lasting loss.
Sources
Read on 11 November 2026. Vendor documentation changes, so check the current page before acting on a detail.
How we work: refund policy · terms of service · about Website Prism
Keep reading