🎯 how-to

How to Tell If a Redirect Is Permanent or Temporary

Learn to distinguish between 301 permanent redirects and 302 temporary redirects — what they mean, when they're used, and why the difference matters for SEO and user experience.

How to Tell If a Redirect Is Permanent or Temporary

When you visit a URL and end up somewhere else, you've been redirected. But not all redirects are created equal — some are permanent moves, others are temporary detours. Understanding the difference helps you interpret web behavior, troubleshoot issues, and make smarter decisions if you manage websites.


This guide explains how to tell if a redirect is permanent or temporary, focusing on the two most common types: 301 and 302. No exploit techniques — just literacy.


What Is a Redirect?


A redirect happens when a server tells your browser: "The content you requested isn't here — go to this other URL instead."


Your browser automatically follows the redirect and loads the new location. You see the final page, but behind the scenes, HTTP status codes tell the story.


Redirects are used for:


  • Moving content to a new URL
  • Consolidating multiple URLs to one canonical version
  • A/B testing different page versions
  • Taking users to login pages before accessing protected content
  • Switching from HTTP to HTTPS

  • The key question: is this move permanent or temporary?


    Related: HTTP Status Codes Decoded — understand the numbers that power the web.


    The Two Main Types: 301 vs 302


    301 Moved Permanently


    What it means:


    The resource has permanently moved to a new URL. The server is saying: "This content used to live here, but it's now at this new address — forever. Update your bookmarks."


    When it's used:


  • A website changes domains (`oldsite.com` → `newsite.com`)
  • A page permanently moves (`/old-page` → `/new-page`)
  • Upgrading from HTTP to HTTPS permanently
  • Consolidating duplicate content under one URL for SEO

  • What browsers and search engines do:


  • Browsers can cache the redirect, so future visits skip the old URL entirely
  • Search engines transfer SEO value (ranking, backlinks) to the new URL
  • The old URL essentially disappears from search results over time

  • Example:


    You rebrand your company from ExampleCorp to BetterCorp. You set up a 301 redirect from examplecorp.com to bettercorp.com. Search engines recognize the permanent move and credit your new domain with the old domain's authority.


    Learn more: How to Read an HTTP Status Code Without Panic


    302 Found (Temporary Redirect)


    What it means:


    The resource is temporarily at a different URL. The server is saying: "Go here for now, but the original URL is still valid and might change back later."


    When it's used:


  • A/B testing (sending users to different page versions)
  • Maintenance pages (temporarily showing a different page)
  • Seasonal campaigns (redirecting to a promotion page temporarily)
  • Login flows (redirecting to a login page, then back to the original page)

  • What browsers and search engines do:


  • Browsers do NOT cache the redirect permanently
  • Search engines keep the original URL in their index
  • SEO value stays with the original URL, not the redirect destination

  • Example:


    You're running a holiday sale. You temporarily redirect your homepage to /holiday-sale. After the sale, you remove the redirect. Since it was a 302, search engines still rank your homepage normally — they knew it was temporary.


    How to Check: Developer Tools


    You don't always see status codes directly in the browser. Here's how to inspect them.


    Using Browser DevTools (Chrome, Edge, Firefox)


  • Press **F12** to open Developer Tools
  • Go to the **Network** tab
  • Reload the page (F5 or Cmd+R)
  • Look for the first request in the list
  • Check the **Status** column

  • What you'll see:


  • **301**: Permanent redirect (often labeled "Moved Permanently")
  • **302**: Temporary redirect (often labeled "Found")
  • **307**: Temporary redirect (modern alternative to 302, preserves request method)
  • **308**: Permanent redirect (modern alternative to 301, preserves request method)

  • Tip: Redirects often chain. You might see multiple 3xx responses before the final 200 OK. Follow the chain to see the full journey.


    Using curl (Command Line)


    If you prefer the terminal:


    curl -I https://example.com


    The -I flag fetches only headers. Look for the status line:


    HTTP/1.1 301 Moved Permanently

    Location: https://newexample.com


    The Location header tells you where the redirect points.


    Want to follow redirects automatically?


    curl -L -I https://example.com


    The -L flag follows redirects and shows the final destination.


    Related: The Journey of a URL — see what happens when you press Enter in your browser.


    301 vs 302: Quick Comparison


    | Feature | 301 Permanent | 302 Temporary |

    |---------|-------------------|-------------------|

    | Intent | Content has moved forever | Content is temporarily elsewhere |

    | SEO impact | Search engines transfer ranking to new URL | Original URL keeps its ranking |

    | Browser caching | Often cached (future visits skip old URL) | Not cached permanently |

    | When to use | Domain changes, permanent URL restructures | A/B tests, maintenance, login flows |

    | Update bookmarks? | Yes — the old URL is obsolete | No — the original URL still works |


    Modern Alternatives: 307 and 308


    307 Temporary Redirect and 308 Permanent Redirect are newer alternatives to 302 and 301.


    What's different:


    The older 301 and 302 codes allowed browsers to change a POST request to a GET request when following the redirect. This was sometimes unintended behavior.


    307 and 308 preserve the original request method:


  • If the original request was POST, the redirect request is also POST
  • If it was GET, the redirect request is GET

  • When to use them:


    Use 307 and 308 when you need strict control over HTTP methods. For most simple redirects (like moving pages), 301 and 302 work fine.


    Why the Difference Matters


    For Website Owners


    Choosing the wrong redirect can hurt SEO:


  • Use a 302 when you mean 301 → Search engines keep ranking the old URL, and the new URL doesn't get credit
  • Use a 301 when you mean 302 → Search engines may prematurely devalue the original URL

  • Example mistake:


    You temporarily redirect /product-a to /product-b during a stockout, but you accidentally use 301. Search engines interpret this as a permanent move and start transferring ranking. When product A is back in stock and you remove the redirect, you've lost SEO value.


    For Users


    As a user, understanding redirects helps you:


  • Know if a bookmark is permanently outdated (301) or just temporarily redirected (302)
  • Recognize when a site is testing different versions (302 often signals A/B tests)
  • Diagnose weird caching behavior (301 redirects cache aggressively)

  • For Developers


    Debugging redirects is easier when you understand the intent:


  • Unexpected 301? Check if someone set a permanent redirect when they meant temporary
  • Redirect loops? Check if two URLs redirect to each other
  • SEO issues? Verify redirects match intent (permanent vs temporary)

  • Related reading: What DNS Does — understand how domain names resolve before redirects even happen.


    Other Redirect Codes (Less Common)


    303 See Other:


    Used after a POST request to redirect the user to a GET request (e.g., after submitting a form, redirect to a success page).


    304 Not Modified:


    Technically a redirect, but special. It tells the browser: "The resource hasn't changed since you last fetched it — use your cached version."


    300 Multiple Choices:


    Rare. The server offers multiple options, and the user (or client) chooses. Rarely used in modern web.


    For most use cases, you'll only encounter 301, 302, 307, and 308.


    How to Set Redirects (For Website Owners)


    On Apache (.htaccess)


    301 Permanent:


    Redirect 301 /old-page https://example.com/new-page


    302 Temporary:


    Redirect 302 /old-page https://example.com/new-page


    On Nginx


    301 Permanent:


    location /old-page {

    return 301 https://example.com/new-page;

    }


    302 Temporary:


    location /old-page {

    return 302 https://example.com/new-page;

    }


    In Node.js (Express)


    301 Permanent:


    app.get('/old-page', (req, res) => {

    res.redirect(301, '/new-page');

    });


    302 Temporary:


    app.get('/old-page', (req, res) => {

    res.redirect(302, '/new-page');

    // or just: res.redirect('/new-page'); (302 is default)

    });


    Common Redirect Patterns


    Pattern 1: HTTP to HTTPS


    Use 301 permanent:


    http://example.com → https://example.com


    This is a one-way, permanent upgrade. You never intend to go back to HTTP.


    Pattern 2: www to non-www (or vice versa)


    Use 301 permanent:


    https://www.example.com → https://example.com


    Pick one canonical version and redirect the other permanently. This consolidates SEO value.


    Pattern 3: Maintenance Mode


    Use 302 temporary:


    https://example.com → https://example.com/maintenance


    You're temporarily down for maintenance. Once maintenance is done, you remove the redirect. The original URL should retain its SEO value.


    Pattern 4: Login Required


    Use 302 temporary:


    https://example.com/dashboard → https://example.com/login


    After login, users return to /dashboard. The redirect is temporary and conditional.


    The Takeaway


    301 = Permanent. The content has moved forever. Update bookmarks, search engines transfer SEO value.


    302 = Temporary. The content is temporarily elsewhere. Original URL remains valid, search engines keep it indexed.


    How to check: Use browser DevTools (Network tab) or curl -I to see the status code.


    Why it matters: Choosing the wrong redirect can hurt SEO, confuse users, and cause caching issues. Match the code to your intent.


    Next time you see a redirect in the wild, you'll know whether it's saying "goodbye forever" or "be right back."




    Related Reading:


  • [HTTP Status Codes Decoded](/bits/http-status-codes) — interactive bit on status codes
  • [How to Read an HTTP Status Code Without Panic](/blog/how-to-read-http-status-codes) — plain-language guide to 2xx, 3xx, 4xx, 5xx
  • [The Journey of a URL](/bits/url-journey) — see what happens when you press Enter in your browser
  • [What DNS Does](/bits/what-dns-does) — understanding domain name resolution



  • *This post is part of Hacking Bits, where we explain how everyday technology works — one bit at a time.*


    Related Posts