For a permanent site migration, use 301 redirects; use 302 redirects only when a URL change is temporary and the original URL is expected to return. A 301 tells browsers and search engines that the move is permanent, while a 302 signals a temporary change.
What 301 and 302 redirects mean
An HTTP redirect is a response from a server telling a browser or crawler to request a different URL. The status code describes the nature of that move. A 301 is a permanent redirect; a 302 is a temporary redirect. Both can send visitors to another address, but they communicate different expectations about whether the source URL will remain in use.
For example, if a company moves https://old.example/products/widget permanently to https://new.example/products/widget, the old address should return a 301 to the new one. If a page is temporarily unavailable during a short promotion and visitors should later return to the original page, a 302 may be appropriate.
The codes do not move a site’s content by themselves. They are server responses that need to be configured so each old URL points to the right destination. A redirect to an irrelevant page is still a poor migration, even if its status code is correct.
Why 301 is usually right for a migration
A site migration typically means that a site, page, or URL has moved for good. A 301 gives browsers and search engines that durable signal, and it lets visitors who use saved links or old search results reach the replacement page. Search engines can use redirects as a signal when consolidating their understanding of old and new URLs, though crawling, processing, and ranking changes are not instantaneous or guaranteed.
Use 301 redirects when moving to a new domain, switching a site from HTTP to HTTPS, changing a permanent URL structure, or retiring a page in favor of a genuine replacement. Map pages as closely as possible: an old product page should usually lead to the corresponding product page, not the home page. If there is no useful replacement, return an appropriate not-found or gone response instead of redirecting every removed URL to an unrelated destination.
A 301 is not a promise that rankings or traffic will remain exactly the same. Search engines must recrawl and interpret the new URLs, and other migration factors—such as changed content, broken internal links, or missing pages—can affect results. The redirect communicates the move; it does not guarantee an outcome.
When a 302 makes sense
Use a 302 when the change is genuinely temporary and the original URL should remain the preferred address after the temporary condition ends. Examples include briefly routing visitors to a maintenance notice or directing users to a temporary campaign page while the main page remains the lasting destination.
Once the temporary situation becomes permanent, replace the 302 with a 301 and update links that you control. Leaving a 302 in place indefinitely can send mixed signals about which URL should be treated as the lasting one. Do not choose a 302 simply because it feels safer or easier to reverse: choose it because the move is temporary.
How to plan and implement redirects
A reliable migration starts with an inventory and a URL-to-URL mapping. Before launch, identify the old URLs that matter and decide their precise destinations. Preserve page paths where possible, but do not assume that matching paths will work if the new site uses a different structure.
- Inventory existing URLs. Include important pages, files, and URL variants such as trailing slashes or uppercase paths when relevant. Analytics, search data, sitemaps, and a crawl of the existing site can help reveal URLs to account for.
- Map each old URL. Send it to the closest relevant new page. Consolidate duplicate versions only when the destination is genuinely equivalent.
- Install permanent redirects. For a lasting migration, configure server-side 301 responses where possible. Avoid redirect chains: update rules so an old URL goes directly to its final destination.
- Test representative and important URLs. Check the response status and final destination, including HTTP and HTTPS versions, domain variants, deep pages, and URLs with query strings if those matter to the site.
- Update internal references. Change navigation, page links, canonical URL declarations, and XML sitemaps to use the new URLs rather than relying on redirects.
- Monitor after launch. Review crawl reports, server logs, analytics, and search performance for missed URLs, loops, unexpected 404s, or traffic problems. Keep useful redirects in place rather than removing them immediately.
Common redirect mistakes
- Using a temporary code for a permanent move: A 302 does not clearly describe a lasting migration. Use a 301 when the original URL has permanently moved.
- Redirecting everything to the homepage: This can frustrate visitors and obscure which content was actually replaced. Match destinations to the old page’s subject.
- Creating chains or loops: A chain sends users through multiple redirects; a loop repeatedly sends them between URLs. Both can interfere with access and crawling. Point directly to the final URL and test the rules.
- Forgetting URL variations: A migration may need to account for protocol, hostname, path, and slash differences. Test the versions users and crawlers might request.
- Removing redirects too soon: Old links, bookmarks, or external references can keep sending visitors to the former addresses. There is no universal expiry date; maintain redirects while the old URLs may still be used and the new destinations remain valid.
301 vs 302 and other redirect codes
For a permanent migration, 301 is the usual choice; for a temporary move, 302 is the usual choice. HTTP also defines 307 as a temporary redirect and 308 as a permanent redirect. Unlike the historical 301 and 302 behavior in some clients, 307 and 308 are designed to preserve the request method. This distinction can matter for requests beyond ordinary page navigation, such as form submissions. For a typical content-site migration using GET requests, 301 is widely used for permanent moves.
Redirect behavior can depend on server configuration, browser behavior, and the request type. Test the actual response rather than relying only on a rule’s label or a configuration screen. Also distinguish an HTTP redirect from a canonical tag: a redirect sends the requester elsewhere, while a canonical declaration is a hint about a preferred URL and does not forward visitors.
Frequently Asked Questions
Should I use a 301 or 302 for a domain migration?
Use 301 redirects if the domain change is permanent. Map old URLs to their corresponding new pages and test that the redirects reach the final HTTPS URLs directly.
Will a 301 redirect preserve my SEO rankings?
No redirect can guarantee unchanged rankings. A 301 communicates a permanent move, but search engines need time to process it, and content changes, technical problems, and other migration details can affect results.
Can I change a 302 to a 301 later?
Yes. If a temporary move becomes permanent, update the server rule to return a 301, then check that the old URL points to the intended final destination.
How long should I keep 301 redirects?
There is no fixed period that suits every site. Keep them while visitors, bookmarks, or external links may still use the old URLs and the destination remains appropriate; removing them can make those links fail.
Should every old page redirect to the homepage?
No. Redirect to a close replacement when one exists. If the content has no suitable successor, an honest not-found or gone response is often better than sending users to an unrelated page.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- AI-Personalized Learning: Can Every Student Keep Up?
- The Pirate Bay Alternatives for Safer, Legal Downloads
- Best Graphics Cards for DLSS: Top Picks by Use
- AI Writing Detectors vs Plagiarism Checkers: What They Prove
- TV Resolution Guide: 480p, 720p, 1080p, 4K and 8K
- Small Modular Reactors vs Restarting Nuclear Plants