Website migration: how to protect your SEO
Plan your URLs and monitor the results
Record your starting point
Before changing the website, keep a list of URLs, pages receiving visits and important content. Record useful titles, descriptions and internal links. Search Console and analytics provide a baseline for comparison, rather than a promise of future rankings.
Keep URLs where appropriate
Changing the programming language does not require changing public URLs. Keeping addresses can avoid many redirects. When an address must change, map each old page to a relevant new destination.
Keep search signals consistent
For permanent URL changes, plan permanent server-side redirects to the final destination. Avoid sending every old page to the homepage. Update internal links, canonical URLs and the sitemap. Check that restrictions used during testing have not been left on pages intended for indexing.
Check the website after launch
Test old and new URLs, HTTP responses and access to content. Monitor indexing, errors, impressions and clicks in Search Console. Results may fluctuate while the migration is processed; rankings cannot be guaranteed. If the domain stays the same, changing the programming language alone is not a domain change.
Official reference: Google Search Central — Site moves