When this applies to you
- A new site on a different system, for example moving from WordPress to a static site.
- A change in the address structure, for example from /offer/websites.html to /services/websites/.
- A change of domain.
- Unifying versions: from http to https, or from www to the version without www.
The redirect map
- Collect the old addresses
From the sitemap, from Search Console (pages with impressions and pages with links to them), from analytics and from a tool that crawls the whole site. Don't forget images and PDFs.
- Point each one at a new equivalent
A page on the same topic. It doesn't have to have the same title.
- When there's no equivalent
The closest page by topic. If nothing fits, an honest 404 or 410 error, not a redirect to the home page.
- Write the rules on the server
In the hosting's redirects file or in the server configuration.
- Test before launch
On the test version: every old address should give one 301 redirect and a 200 response at the new address.
# old address new address code /offer/websites.html /services/websites/ 301 /blog/* /knowledge/:splat 301 https://www.company.com/* https://company.com/:splat 301!
Apache, nginx and other servers have their own equivalents of this file. The principle is the same everywhere: one rule per old address or pattern, straight to the target.
The most common mistakes
- Everything to the home page
Google treats mass redirects to an unrelated page much like a 404 error, so the old rankings are lost anyway.
- Redirect chains
A leads to B, and B to C. It slows the site down and makes things harder for crawlers. Always point straight at the target address.
- 302 instead of 301
302 means a temporary change. For a permanent change of address, use 301 or 308.
- Forgotten images and PDFs
They also get search traffic and links from other sites.
- Redirects removed after a month
Google recommends keeping them for at least a year, and ideally forever.
- noindex carried over from the test version
Test versions often block indexing. Copied to production, it removes the whole site from Google.
After launch
Terms from this guide
- 301 redirect
The server's response saying a page has permanently changed its address. The browser and Google go to the new address and transfer the old one's value to it.
Questions and answers
How long should redirects be kept?
Google recommends at least a year, and ideally forever. Keeping a few rules costs nothing, and old links from other sites keep working for years.
Will I lose my Google rankings?
With a good redirect map, rankings usually fluctuate for a while and come back. Large, lasting drops almost always come from missing redirects, heavily changed content or a forgotten indexing block.
Does a 301 redirect pass on the value of links?
Yes. Google treats a permanent redirect as a strong signal that the new address replaces the old one.
Sources and documentation
- Google: site moves with URL changesdevelopers.google.com
- Google: redirects and Google Searchdevelopers.google.com
- Search Console: the change of address toolsupport.google.com
- Netlify: redirectsdocs.netlify.com