Domain redirect (301 vs 302)
Two HTTP status codes for redirects. 301 means 'permanent, update your bookmarks'; 302 means 'temporary, keep coming to the original'. The choice affects SEO.
301 and 302 are both HTTP redirect status codes. The difference is the meaning, and that meaning changes how browsers, search engines, and caches behave.
301 — Moved Permanently
"This URL is gone forever. Use the new one from now on."
- Browsers cache the redirect indefinitely. Next visit to the old URL goes straight to the new one without a request.
- Search engines transfer SEO authority from the old URL to the new one.
- Use for: domain migrations, restructuring URLs, killing a deprecated page.
302 — Found (Moved Temporarily)
"This URL is busy right now. Come back later."
- Browsers don't cache. Every visit re-checks the original URL.
- Search engines keep the original URL in their index.
- Use for: A/B tests, login flows that route users somewhere temporarily, scheduled maintenance pages.
The mistake to avoid
Don't 302 a permanent move. If you redirect acme.com to new-acme.com with 302 thinking "it's temporary while we set things up," search engines never update their index. Six months later you're still serving from the old domain in their results.
Conversely, don't 301 a temporary redirect. If a user is mid-checkout and you 301 them to a "session expired" page, their browser will keep doing that on every revisit until they clear cache.
What to use in practice
Default to 301 for anything you don't plan to undo. Default to 302 (or 307) for anything tied to user state. When in doubt, 307 (Temporary Redirect) is a safer 302 because it preserves the HTTP method (POST stays POST).