Migrating One Area

Learning Website: Framework & Architecture

Chapter 10 ยท Migrating One Area at a Time

You now have a design for the family of sites: a site map, a content model, a shared design layer, three layers of navigation, a pipeline, search and sitemaps, and hosting. What remains is the hardest part, which is getting from the site you have to the sites you want without breaking what works. The safe way is not to rebuild everything and switch over on one weekend. It is to move one area at a time while the old site keeps running. This chapter works through that plan for the languages area, using measurements of your real site.

The Strangler Pattern

The approach is usually called the strangler pattern, after a vine that grows around a tree until it can stand on its own. The new sites grow around the old one. For a while both exist. Each area that moves is verified, redirected and then retired from the old site, so the old site shrinks as the new ones grow, until there is nothing left to retire. At every moment there is a working site, and until an area is retired there is a way back.

Why not move everything at once?
A single big switch gives you one test, one chance, and a very large set of things that can go wrong together. Moving one area gives you a small problem you can understand, and teaches you what to fix before the next area. Google's own site-move guidance accepts a section-by-section move for large sites (Learning Website: Framework & Architecture 7).

Why Languages First

You chose languages first because it is the fastest-growing area. The measurements say it is also the easiest area to move. Exercise 1 scanned the 593 language pages for links:

Link typeCountWhat it means for the move
From languages to another area0Nothing in these pages needs a cross-site link
Into languages from another area0No other page needs updating
Within languages225Stay relative; they keep working
To resource files (/resources/japanese/...)23The files must move with the area
To the kanji tiles page (a special route)30That page moves with the area
To a page that does not exist282An existing bug: fix it first

A clean cut with no links in or out is rare. It means the cross-site navigation work from Chapter 5 is not even needed for the first move, and every later area can be measured the same way before its turn.

Do not move a bug
The 282 broken links are the back-links on the hiragana and katakana character pages: 141 pages each point at /japan/hiragana/hiragana-tiles or /japan/katakana/katakana-tiles. The folders contain the tile content (hiragana_tiles_cms_content.html and its katakana twin), but only the kanji tiles file has a page that routes it. Those links are dead on the current site (checked against the built output). Fix them on the old site first, so the new site starts clean and you can tell whether a later failure is new.

Update: this was fixed after the course was written, by adding the two missing pages (hiragana-tiles.astro and katakana-tiles.astro, modelled on the kanji one). A rebuild and the link check of Chapter 12 then showed the 282 broken links gone.

The Phases

PhaseWhat happensThe way back
0. PrepareMeasure, fix known bugs, scan for secrets, decide the exceptionsNothing has changed yet
1. Build in parallelNew subdomain, certificate and virtual host; first release deployed; crawling blockedDelete the new site; the old one is untouched
2. VerifyCompare pages, links, files and visuals against the old siteThe old site still serves everyone
3. Rehearse redirectsTurn on the redirect rule as 302 (temporary) and test every old URLRemove the rule
4. SwitchAllow crawling, submit the sitemap, change redirects to 301, replace the old menu entry with a linkSwitch the rule back to 302 or remove it
5. WatchLogs, Search Console, visitor reports, for several weeksAs above
6. RetireRemove the area from the old site's build; keep redirects for at least a yearRestore from the content folder and the release history

The block on crawling in phase 1 matters because, until the switch, both sites would serve the same pages. Search engines should find the pages in one place only (Chapter 7's rule about one address per page).

Verify with Scripts, Not Eyes

During phase 2 the question is “did every page survive?”. Compare two sets: the pages the content tree says should exist, and the pages that were actually built, in both directions. Exercise 2 does this on today's build as a rehearsal:

What the rehearsal showed
Of 4,925 expected pages, none was missing from the build. The build also contains 89 pages that nobody planned: mostly the printable versions of cheat sheets and lessons (names ending in _print), some resource folders, the home page, the admin dashboard and the course index. So the print versions are real, public pages. Decide what you want for them (keep, point a canonical link at the main page, or ask search engines not to index them), and then the migration will not surprise you with them.

Use the same check on the new site, with the area's expected pages against its output folder. The goal is zero missing pages and an extras list you can explain line by line.

The Exceptions List

Pages move by their folder, but some things are not content folders. Exercise 3 inventories them from the real public/ folder:

ItemSizeDecision
/resources/japanese/312 files, 1.6 MBMoves with the languages area
/resources/hungarian/11 files, 104.8 MBMoves with the area, after checking (see below)
/japan/kanji-tiles/one pageMoves with the area
Other resource folderscsset, jquery, js, js2021, linux, php, postmanNot language assets: they stay until their own areas move
Look at the 105 MB folder before you copy it
/resources/hungarian/ holds PDFs, a video and screenshots, and their names look like a published Hungarian textbook and a lesson recording. Before copying them to a new public site, check that you have the right to publish them (the course Copyright & Fair Use covers this), and consider whether 100 MB of video belongs in the web root at all. A move is a good moment to clean up.

Running Side by Side

For the duration of the migration the old site's virtual host does not change; the new one is added beside it (Chapter 8). The old site's menu and the new site's global bar link to each other so that visitors can find their way. The only place the two meet is the redirect rule on the old site, which stays off until phase 3. During the move, treat the content folder as the single source for both: the old site builds from it, the new site builds from it, and a correction in one place appears in both until the area is retired.

After the Switch

  • Redirects stay for at least a year, and ideally forever, because old links live in other people's bookmarks and pages.
  • The old menu entry changes from a dropdown of language courses to a single link to the new site.
  • Search Console: add the new site, submit its sitemap, and watch crawl errors and coverage for the old addresses.
  • Then repeat for the next area: measure its links, list its exceptions, fix its bugs, and follow the same phases.

Hands-On Exercises

Exercise 1

Write a link inventory for one area: count its links to its own pages, to other areas, to special routes and to resource files, count links into it from other areas, and check that every target exists. Run it on the languages area and say what it tells you about the move.

๐Ÿ“„ View solution
Exercise 2

Write a parity check that compares the pages the content tree expects with the pages in a build output, reporting pages missing from the build and pages built but not expected. Run it on the current site's build and explain the extras.

๐Ÿ“„ View solution
Exercise 3

Inventory the resource folders and special routes that do not move by the folder rule, decide where each goes, and write a seven-phase cutover plan for the languages area with a way back at every phase.

๐Ÿ“„ View solution

Chapter 10 Quick Reference

  • Strangler pattern: new sites grow around the old; move, verify, redirect, retire one area at a time
  • Languages is the first area: 0 links in or out across 593 pages, so it is a clean cut
  • Fix existing bugs first: 282 dead back-links (hiragana and katakana tile pages)
  • Phases: prepare, build in parallel (crawling blocked), verify, rehearse with 302, switch with 301, watch, retire
  • Verify with scripts: expected pages against built pages, in both directions
  • The current build has 0 missing pages and 89 unplanned ones (mainly print variants)
  • List what does not move by folder: resource folders and special routes
  • Check /resources/hungarian/ (104.8 MB) before copying it to a new site
  • Keep redirects at least a year; change the old menu entry into a link; repeat for the next area