HTTP 301 vs 302 Redirects — Permanent vs Temporary
Informational3xx redirection
Overview
HTTP 301 is a permanent redirect and 302 is a temporary redirect. Choosing the wrong one impacts SEO, caching, and user experience.
Key Details
- 301 Moved Permanently — the resource has a new permanent URL
- 302 Found — the resource is temporarily at a different URL
- 301 passes SEO link equity to the new URL, 302 does not
- Browsers cache 301 redirects aggressively, 302 redirects are re-checked
- Search engines update their index for 301 but keep the original URL for 302
Common Causes
- Website migrated to a new domain (use 301)
- Page moved to a new URL path permanently (use 301)
- A/B testing sending users to alternate pages temporarily (use 302)
- Maintenance page redirect while the real page is updated (use 302)
- Login redirect to authentication page (use 302)
Steps
- 1Use 301 for permanent URL changes: domain migrations, URL restructuring
- 2Use 302 for temporary redirects: A/B tests, maintenance, login flows
- 3In nginx: return 301 https://new-url (permanent) or return 302 https://temp-url (temporary)
- 4In Apache: Redirect 301 /old-path https://new-url or Redirect 302 /old-path https://temp-url
- 5Test redirects with curl -I URL to verify the status code
Tags
httpredirect301302seo
More in 3xx Redirection
http-300-multiple-choicesHTTP 300 Multiple Choices — What It Means & How to Fix It
Warninghttp-301-moved-permanentlyHTTP 301 Moved Permanently — What It Means & How to Fix It
Warninghttp-302-foundHTTP 302 Found — What It Means & How to Fix It
Warninghttp-303-see-otherHTTP 303 See Other — What It Means & How to Fix It
Warninghttp-304-not-modifiedHTTP 304 Not Modified — What It Means & How to Fix It
Warninghttp-305-use-proxyHTTP 305 Use Proxy — What It Means & How to Fix It
WarningFrequently Asked Questions
301 for permanent changes. It tells search engines to transfer ranking signals to the new URL. Using 302 for permanent moves wastes SEO equity.