Redirects and canonicals Recommended
Move a site or domain without losing links
When a whole site or domain moves, redirect every old address one to one. Keep the redirects as long as possible, and at least a year.
How to do it
Map every old URL before the move. Keep the old domain registered with a valid certificate, so HTTPS links still reach the redirect. Publish a sitemap of the new addresses and update every canonical and hreflang link. For a new domain or subdomain, use Google Search Console's Change of Address tool. It is not needed for HTTPS, www or path changes.
How to check
A test requests every address from the old sitemap on the old domain, over HTTP and HTTPS. Each answers one 301 to the matching page on the new one, which answers 200.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/redirects-and-canonicals/site-moves.