Drupal Relaunch Without SEO Collapse
Six days after we flipped DNS on a 14-year-old industrial parts catalog, Grafana looked like a victory lap. Median TTFB dropped from 640 ms to 118 ms. PHP-FPM sat under 30% CPU, Varnish hit 89% cache efficiency, and zero 500 errors hit Sentry. Moving off Drupal 7 onto Drupal 10 felt like the cleanest cutover I'd shipped in five years.
Then Google Search Console caught up with its 48-hour reporting lag. Impressions bent downward on day six, buckled on day seven, and by day nine non-branded sessions sat 45.2% below the trailing 28-day baseline. Search Console showed 18,412 indexed URLs spilling into "Not found (404)" and "Duplicate without user-selected canonical." Nobody deleted a product spec sheet. We broke the URL contract feeding $4.2 million in annual distributor leads.
The irony stings. Months earlier, we had steered clear of a flashy frontend rewrite—applying the same headless CMS versus monolithic reality checks that keep lean teams sane—and stuck with server-rendered Twig templates to avoid SEO surprises. Boring templates didn't save us from sloppy URL plumbing.
Autopsy of a 45% Traffic Drop
Diffing 72 hours of Googlebot access logs against a pre-launch Screaming Frog crawl exposed three separate failures. None triggered a PHP exception, so launch-day alerts stayed green.
1. Missing Pathauto Aliases and Dropped D7 Redirects (41% of Lost Clicks)
The legacy Drupal 7 database held 63,200 rows in url_alias plus 19,800 rows in redirect. Over a decade, editors hand-typed custom slugs for flagship product lines before anyone standardized Pathauto patterns. Our Drupal 10 Migrate API pipeline re-ran Pathauto on save using cleaner token rules, silently overwriting thousands of battle-tested slugs. Worse, nobody ran d7_path_redirect during the final delta sync.
2. Trailing-Slash Drift and Case-Sensitive Misses (32% of Lost Clicks)
Our old Apache front end ran an eccentric .htaccess rule appending trailing slashes to section hubs like /valves/ball-valves/ while leaving leaf nodes bare. Our new Nginx config normalized slashes inconsistently and dropped Apache's mod_speling case folding. Mixed-case datasheet links from 2016 distributor PDFs—like /Specs/HX-400-Series—returned raw 404s or double 302 hops.
3. Unindexed and Orphaned Taxonomy Views (27% of Lost Clicks)
Roughly 420 commercial long-tail landing pages lived on Drupal 7 contextual-filter Views at /applications/% and /industries/%. In Drupal 10, rebuilt Views switched URL arguments from hyphenated term names to numeric IDs, lacked canonical tags on paginated pages (exposing ?page=0 duplicates), and shipped with a staging robots.txt blocking /taxonomy/ for 74 hours.
Build a Legacy URL Ledger Before Touching DNS
One habit I carry from doing legacy ExpressionEngine site audits is never trusting a CMS's XML sitemap as your complete inventory. Old sites accumulate ghost URLs—retired campaigns, renamed category hubs, uppercase PDFs—that vanished from sitemaps years ago yet still hold links from trade journals and forums.
Before cutover, compile a flat TSV ledger of every URL carrying crawl traffic or backlinks. Merge four sources: Drupal 7's url_alias table, its redirect table, 90 days of edge logs filtered for Googlebot and Bingbot 200 responses, and a Search Console plus backlink export. Remember one nasty D7-to-D10 schema trap: Drupal 7 stores aliases without a leading slash (products/gate-valve-400), whereas Drupal 10's path_alias table mandates one (/products/gate-valve-400). Normalize that early.
SELECT CONCAT('/', ua.alias) AS legacy_path, ua.source, n.status
FROM url_alias ua
LEFT JOIN node n ON ua.source = CONCAT('node/', n.nid)
WHERE ua.language IN ('und', 'en');
SELECT CONCAT('/', r.source) AS old_path,
CONCAT('/', COALESCE(ua.alias, r.redirect)) AS target_path
FROM redirect r
LEFT JOIN url_alias ua ON r.redirect = ua.source
WHERE r.status_code IN (301, 302);
Commit that ledger into Git as ops/legacy-urls.tsv. Once versioned, every staging deploy gets verified against revenue-bearing paths instead of five homepage curls.
Move Bulk Redirects Out of PHP Into Nginx Maps
Our knee-jerk fix on day nine was importing 61,000 missing aliases into Drupal 10's redirect module. That stopped 404s for four hours—until Googlebot ramped crawl rate and hammered PHP-FPM. Every legacy lookup bootstrapped Drupal's container, queried MariaDB, and bypassed page cache on query-string variants. p95 latency jumped back to 510 ms.
Static HTTP 301 URL redirection belongs at the reverse proxy edge, not inside PHP. Nginx's map directive compiles exact lookups into an in-memory hash table on reload. Serving 65,000 redirect rows costs roughly 14 MB of RAM per worker and resolves in under a millisecond with zero database load.
Two Nginx details trip people up constantly. First, key your map on $request_uri instead of $uri. Nginx strips query strings and normalizes percent-encoding in $uri, breaking legacy Drupal 7 Views like /catalog?tid=42. Second, bump map_hash_bucket_size and map_hash_max_size in your http block before reloading, or nginx -t aborts with a hash collision error on long slugs.
map_hash_bucket_size 128;
map_hash_max_size 131072;
map $request_uri $d7_redirect {
default "";
include /etc/nginx/maps/d7_exact.map;
}
# Generated entries in /etc/nginx/maps/d7_exact.map
/catalog?tid=42 /products/ball-valves;
/valves/ball-valves/ /products/ball-valves;
/Specs/HX-400-Series /datasheets/hx-400-series;
Directive order inside server matters just as much. If you strip trailing slashes first and check your map second, /valves/ball-valves/ gets 301'd to /valves/ball-valves and then 301'd again to /products/ball-valves. Redirect chains burn crawl budget and dilute link equity. Check the exact map first, emit both slash and non-slash keys in your generator script, and run trailing-slash normalization only on unmatched paths.
server {
listen 443 ssl http2;
server_name catalog.example.com;
root /var/www/drupal10/web;
if ($d7_redirect != "") {
return 301 https://$host$d7_redirect;
}
rewrite ^/(.+)/$ https://$host/$1 permanent;
location / {
try_files $uri /index.php?$query_string;
}
}
Postmortem rule of thumb: if any legacy URL needs more than one 301 hop to hit a 200 OK canonical page, treat it as broken. Flatten chains while generating the Nginx map at build time, never at request time.
Locking Down Pathauto, Taxonomy Views, and Canonicals in Drupal 10
Edge redirects stopped the hemorrhage, yet we still had to stop Drupal 10 from creating URL drift whenever an editor saved a node. Inside our Migrate API YAML, we added path/pathauto: 0 on migrated entities carrying a preserved D7 alias. Net-new articles still use Drupal 10 Pathauto tokens, while migrated nodes keep historic slugs untouched unless deliberately changed.
We also locked Pathauto's update setting via drush config:set pathauto.settings update_action 2 so editing a title or taxonomy term creates a new alias and writes a 301 redirect from the old URL instead of deleting it. That governance snag isn't unique to public catalogs—I've seen the same editorial habit while weighing open-source intranet CMS tradeoffs, where editors reorganize categories like shared-drive folders without realizing every rename breaks bookmarks.
Taxonomy Views needed surgical cleanup. Out of the box, Drupal 10 enables a core taxonomy_term View at /taxonomy/term/%. When you build custom marketing Views at /applications/% and leave the core route exposed, Google crawls both and splits ranking signals. We fixed it in three passes:
- Swapped numeric contextual arguments for a slug validator bound to each term's preserved alias, restoring URL parity across all 420 landing pages.
- Enabled
metatag_viewsand set explicit canonicals per View display, stripping?page=0while keeping page two onward self-canonicalized. - Pointed Rabbit Hole on raw
/taxonomy/term/%routes to 301-redirect toward each custom View path, and scrubbedDisallow: /taxonomy/out ofrobots.txt.
Disciplined migration playbooks—like the enterprise CMS relaunch blueprints on CMS Connection—treat taxonomy landing pages and faceted Views as Tier-1 revenue templates rather than backend plumbing. We spent nine days of organic pipeline relearning that rule.
Gating Cutover With an Automated URL Contract Test
We won't ship another Drupal relaunch by spot-checking twenty URLs in Chrome. Our CI pipeline now runs a Python verifier against staging before anyone touches Route 53. It replays the top 15,000 traffic-bearing rows from ops/legacy-urls.tsv, enforces single-hop 301s, verifies the target returns 200 OK, and confirms no stray X-Robots-Tag: noindex header slipped into staging config.
import csv, sys, requests
STAGING = "https://staging-catalog.example.com"
failures = []
with open("ops/legacy-urls.tsv", newline="") as f:
for row in csv.DictReader(f, delimiter="\t"):
path = row["legacy_path"]
r1 = requests.head(STAGING + path, allow_redirects=False, timeout=5)
if r1.status_code == 200:
final = r1
elif r1.status_code == 301:
loc = r1.headers.get("Location", "")
final = requests.head(loc, allow_redirects=False, timeout=5)
if final.status_code != 200:
failures.append((path, f"chain {final.status_code}"))
continue
else:
failures.append((path, f"status {r1.status_code}"))
continue
if "noindex" in final.headers.get("X-Robots-Tag", "").lower():
failures.append((path, "leaked noindex"))
if len(failures) > 30:
sys.exit(1)
After deploying the flattened Nginx map (61,480 rules), unifying trailing-slash rewrites, restoring 420 taxonomy Views, and submitting a fresh XML sitemap index, crawl errors dropped from 18,412 to 136 inside eleven days. Organic traffic reached 96% of baseline by week five. By week nine, once faster TTFB and cleaner Core Web Vitals settled in, non-branded sessions sat 8.4% above the old Drupal 7 site.
The Pre-Launch URL Survival Checklist
If you're staring down a Drupal 7 to Drupal 10 or 11 cutover this quarter, paste this checklist into your release ticket and hold DNS until every line passes:
- Export every row from D7
url_aliasandredirect, merge with 90 days of bot logs, and prepend leading slashes for Drupal 10 parity. - Set
path/pathauto: 0in Migrate API pipelines so historic custom slugs aren't regenerated on import. - Flatten redirect chains at build time into an Nginx
map $request_uritable with sized hash buckets, running exact lookups ahead of trailing-slash rules. - Audit contextual-filter Views and taxonomy routes for slug parity, explicit
metatag_viewscanonicals, and closed/taxonomy/term/%duplicates. - Diff production
robots.txtagainst staging line by line and verifyX-Robots-Tagheaders don't leak from non-production templates. - Gate DNS cutover on an automated HTTP verifier confirming single-hop
301to200resolution across your top 10,000 organic landing pages.
Fast servers and tidy Symfony code feel great to ship, yet search engines don't reward cleaner architecture when you break twenty thousand doorways on launch morning. Protect the URLs first; celebrate the Grafana charts a month later.
Comments
Post a Comment