301 vs 302 Redirects: Preserve SEO Equity During Migrations

Migrations fail quietly when the wrong status code is used. A temporary 302 on a permanent move leaves equity stranded on the old URL; a permanent 301 on a staging experiment can stick in caches for months. The free redirect map compiler on ToolMars turns old/new pairs into production-ready Nginx, Apache, or Next.js rules — privately, in your browser.
Status codes are part of your SEO contract with crawlers and browsers. Get them right once, keep chains short, and document every path change in a spreadsheet you can recompile.
Compile bulk 301/302 maps for any stack
Free redirect compiler — Nginx, Apache, Next.js from CSV — runs in your browser.
Permanent vs Temporary: When to Use Each
301 Moved Permanently tells clients to update bookmarks and search engines to consolidate ranking signals on the destination. Use it for domain migrations, slug renames, HTTP→HTTPS, and www/apex consolidation.
302 Found (and similar temporary codes like 307) means “come back to the original later.” Use it for A/B tests, geo experiments, or short maintenance pages — then remove the rule when the test ends so the temporary URL does not linger in indexes.
- 301 — lasting move; equity should follow.
- 302 — temporary detour; original URL stays canonical.
- Avoid 302 “just in case” — soft-permanent moves confuse crawlers for months.
Kill Redirect Chains and Loops
Chains like /a → /b → /c burn crawl budget and risk timeout failures on strict bots. After each migration wave, audit for multi-hop paths and collapse them to a single 301. Loops (/a → /b → /a) are worse — browsers stop, users bounce, and rankings crater.
www, HTTPS, and Single-Hop Canonicals
Pick one host (www or apex) and HTTPS-only. Redirect everything else with 301s. Pair server rules with a matching canonical tag and a clean robots.txt so crawlers are not blocked from following the new paths. Use the slug generator when renaming many URLs so destinations stay consistent.
Nginx, Apache, and Next.js Snippets
Exact path maps scale better than long rewrite lists. Examples for a permanent move:
# Nginx map + permanent redirect
map $uri $new_uri {
/old-page/ /new-page/;
}
server {
if ($new_uri) { return 301 $new_uri; }
}# Apache RewriteMap (txt) + 301
# redirects.txt: /old-page/ /new-page/
RewriteMap redirects txt:/etc/apache2/redirects.txt
RewriteCond ${redirects:$1} !=""
RewriteRule ^(.*)$ ${redirects:$1} [R=301,L]// next.config.js — permanent: true → HTTP 301
module.exports = {
async redirects() {
return [
{
source: "/old-page/",
destination: "/new-page/",
permanent: true,
},
// temporary campaign: permanent: false → 302
];
},
};CSV Redirect Maps at Scale
Migration workflow
- Export a two-column list: old path, new path (space, tab, or CSV).
- Paste into the redirect compiler and choose Nginx, Apache, or Next.js output.
- Deploy to staging; crawl for chains, loops, and 404 destinations.
- Ship production 301s the same day internal links and sitemaps update.
- Monitor Search Console coverage until the new URLs stabilize.
Related Tools
- Redirect compiler — CSV → Nginx / Apache / Next.js
- Robots generator — keep crawlers aligned after moves
- Slug generator — consistent destination paths
Conclusion
Use 301s for lasting moves, 302s only for true temporaries, flatten chains, and enforce HTTPS/host in a single hop. Compile CSV maps instead of hand-editing hundreds of rules — then verify crawl paths before you celebrate the launch.
Compile bulk 301/302 maps for any stack
Free redirect compiler — Nginx, Apache, Next.js from CSV — runs in your browser.
Frequently Asked Questions
301 vs 302 in one line?
301 = permanent move with equity transfer; 302 = temporary detour.
Which for site migrations?
Almost always 301 — reserve 302 for short tests and seasonal detours.
Why avoid redirect chains?
Extra hops waste crawl budget and can drop signals — flatten to one 301.
www and HTTPS redirects?
Always permanent 301s, ideally combined into a single hop.
Why use a CSV map?
Spreadsheets scale, review easily, and compile into platform-specific configs.
Does a 301 guarantee rankings?
No — it consolidates signals; destination quality and internal links still matter.
Is ToolMars compilation private?
Yes — URL pairs are processed locally and never uploaded.