Skip to content
← All articles

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

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

When to Use 302

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

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 now →
More articles: HTTP
HTTP
HTTP Caching Guide: Cache-Control, ETag, Expires
14.03.2026 · 39 views
HTTP
The Complete HTTP Request Lifecycle: From URL to Rendered Page
16.03.2026 · 55 views
HTTP
HTTP 500 Internal Server Error: What It Means and How to Fix
15.04.2026 · 9 views
HTTP
HTTP/2 vs HTTP/3: What's New and Why Upgrade
14.03.2026 · 37 views