Skip to content
RU
← All articles

HTTP 301 vs 302 Redirect: Differences and When to Use Each

A redirect chain check on a monitor and a terminal with server responses

In short. 301 says the move is permanent, so browsers cache it and search engines transfer signals to the destination. 302 says the original will return. The cost of confusing them is asymmetric: a wrongly permanent redirect is cached by browsers and hard to take back.

301 and 302 are the two most common HTTP redirects, and even seasoned developers confuse them. The wrong choice costs SEO rankings, breaks analytics, and creates redirect loops. This article covers the fundamental difference, SEO impact, when to use each, and real setup examples for nginx, Apache, PHP, and WordPress.

What Is 301 Moved Permanently

Per RFC 9110 §15.4.2, 301 means: "this resource has moved permanently — use the new URL for all future requests." Search engines transfer ~90-99% of SEO equity from the old URL to the new one. Browsers cache the redirect aggressively.

What Is 302 Found

The 302 code (RFC 9110 §15.4.3) means: "the resource is temporarily available at a different URL, but the original URL remains authoritative." SEO equity is NOT transferred — the old URL stays indexed. Browsers do not cache.

Key Differences

Aspect301302
SemanticsPermanentTemporary
SEO equityTransferredNot transferred
Browser cachingYes (aggressive)No
Indexed URLNew URLOld URL
Request methodMay change to GETMay change to GET

When to Use 301

  • Domain migration (example.com → example.io)
  • URL structure change (switching to clean URLs)
  • HTTP → HTTPS
  • www → non-www (or vice versa)
  • Removing outdated pages with a replacement target
  • Changing blog post slugs

When to Use 302

  • A/B testing — temporarily route part of traffic elsewhere
  • Maintenance mode — redirect to a holding page
  • Geo routing (edge case — 307 is usually better)
  • Temporary promotions — revert to canonical after the campaign
  • Authentication — post-login redirect to the originally requested page

nginx Configuration

# 301 permanent
location = /old-page {
    return 301 https://example.com/new-page;
}

# 302 temporary
location = /promo {
    return 302 https://example.com/black-friday;
}

# HTTP → HTTPS (always 301)
server {
    listen 80;
    server_name example.com;
    return 301 https://$host$request_uri;
}

Apache (.htaccess)

# 301
Redirect 301 /old-page /new-page

# 302
Redirect 302 /promo /black-friday

# HTTP → HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

PHP

<?php
// 301
header('Location: https://example.com/new-page', true, 301);
exit;

// 302 (default, but be explicit)
header('Location: https://example.com/temp-page', true, 302);
exit;

WordPress

Use the Redirection or Rank Math plugin, or in code:

add_action('template_redirect', function () {
    if (is_page('old-page')) {
        wp_redirect(home_url('/new-page'), 301);
        exit;
    }
});

SEO Risks of Wrong Choice

  1. 302 instead of 301 on migration → Google does not pass equity, new URL does not rank.
  2. 301 for A/B testing → browsers cache it; you cannot roll back quickly.
  3. Redirect chains → 301 → 301 → 301 loses up to 15% equity and adds latency.
  4. Protocol mismatch — always verify your HTTPS chain.

Inspect redirect chains with the HTTP Header Checker by Enterno.io — it shows every hop with status codes and timing.

303, 307, 308 — When Needed

  • 303 See Other — redirect after POST to a GET (POST-Redirect-Get pattern)
  • 307 Temporary Redirect — like 302, but method and body are preserved
  • 308 Permanent Redirect — like 301, but method and body are preserved

Frequently Asked Questions

Q: Is full SEO equity passed through 301?
A: Google officially states: "301 redirects pass full PageRank." In practice, 90-99% is observed.

Q: How many chained redirects are acceptable?
A: At most one hop. Each extra redirect = SEO loss + 100-200ms latency.

Q: How do I check which code a redirect returns?
A: curl -I https://example.com or use the Enterno.io HTTP Checker — it displays the full chain.

Q: Can I use 302 permanently?
A: You can, but it is a mistake. Google may eventually treat a persistent 302 as 301, but the behavior is unpredictable.

Conclusion

The rule is simple: 301 for permanent changes, 302 for temporary ones. 99% of production redirects should be 301. Always inspect chains via the HTTP Header Checker and avoid multi-hop redirects.

Check your website right now

Check your site's HTTP status →
More articles: HTTP
HTTP
404 Not Found Error: Causes and Fixes for Chrome, nginx, Apache
15.04.2026 · 1 967 views
HTTP
HTTP Methods Explained: GET, POST, PUT, DELETE and Beyond
16.03.2026 · 978 views
HTTP
Server-Sent Events vs WebSockets: Which to Use for Realtime
16.03.2026 · 974 views
HTTP
The Complete HTTP Request Lifecycle: From URL to Rendered Page
16.03.2026 · 892 views