Q: Should I do migration redirects in .htaccess, Nginx, or at the CDN level?
Good instinct to ask before you build them — the layer you choose affects speed and how easy they are to manage.
Short answer: CDN/edge for big domain moves, server config (Nginx/.htaccess) for everything else, app-level only as a last resort.
Long answer:
Edge redirects (Cloudflare Rules, etc.) fire before the request hits your server — fastest, and they survive even if origin is down. Best for whole-domain migrations.
Nginx is faster than .htaccess (which Apache re-reads per request) and handles regex maps cleanly for thousands of URLs. .htaccess is fine for smaller sites and quick edits without a reload.
Avoid PHP/app-level redirects for migrations — they're the slowest and add a redundant hop.
Next step: if you have over a few hundred rules, build a regex map in Nginx rather than line-by-line redirects.
Migration Helpdesk
@MigrationHelpdesk
Q: Should I do migration redirects in .htaccess, Nginx, or at the CDN level?
Этот пост опубликован в Telegram-канале Migration Helpdesk. Подписаться можно по ссылке: @MigrationHelpdesk.