Permanent and temporary
Google groups them by intent. Google uses a permanent redirect (301 or 308) as a signal that the target should be the canonical URL, and shows the target in results. It does not use a temporary redirect (302, 303 or 307) that way, so it tends to keep the source page in results. Google recommends a permanent server-side redirect whenever you move a URL for good, and advises JavaScript redirects only as a last resort.
Where they go wrong
A 302 left in place after a migration, a redirect to a login or home page instead of the equivalent page, a redirect that loops and a long chain of hops. After a site move Google suggests keeping redirects for as long as possible, generally at least a year.
How to see it
curl -sIL https://example.com/old-page | grep -iE '^(HTTP|location)' prints the status and the Location of every hop. A good migration shows HTTP/2 301, then location: https://example.com/new-page, then HTTP/2 200. The problems to look for are a 302 that should be permanent, a second redirect in a row, and a final 200 on the home page instead of on the new page.
What to check
The status and the final URL of the old URLs that matter, the number of hops and the four variants of the site address.
Sources
Read on . Standards and vendor pages change; confirm the current text before you rely on it.
- Google Search Central, Redirects and Google Search (developers.google.com)