Error Codes Wiki

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

  1. 1Use 301 for permanent URL changes: domain migrations, URL restructuring
  2. 2Use 302 for temporary redirects: A/B tests, maintenance, login flows
  3. 3In nginx: return 301 https://new-url (permanent) or return 302 https://temp-url (temporary)
  4. 4In Apache: Redirect 301 /old-path https://new-url or Redirect 302 /old-path https://temp-url
  5. 5Test redirects with curl -I URL to verify the status code

Tags

httpredirect301302seo

More in 3xx Redirection

Frequently 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.