Basics

What is a redirect — and why a 302 keeps the old address in search

Illustration: a road sign turning traffic toward a new address

There's a stubborn myth out there: "a 302 eats your link juice, always use a 301." Half true — and not the useful half.

The real difference is simpler and meaner. Whether you use a 301 or a 302 decides which address Google keeps in its index — the new one or the old one. Five minutes and you'll be picking on purpose.

What a redirect is

A redirect is the server saying "that page isn't here anymore, go there instead."

You open site.com/old. The server doesn't hand you a page. It answers with a code from the 3xx family (see HTTP status codes) and attaches a Location header with the new address. Your browser quietly follows it. You only ever see the final page — the hop takes a fraction of a second.

It's the note on a closed shop's door: "we moved one street over." The visitor reads it and walks on. The only twist is that browsers read those notes by themselves.

The key part: a redirect isn't a link inside a page. There is no page. There's only the sign.

301 vs 302: the fight isn't about "juice," it's about the index

Both codes move a human the same way. A human sees no difference. A search engine does.

  • 301 — moved permanently. Google's docs say it plainly: Googlebot follows the redirect, and the indexing pipeline uses it as a signal that the redirect target should be canonical. The new address is what ends up in search.
  • 302 — temporary. Googlebot follows it too, but does not treat it as a signal to change the canonical page. The old address stays in the index.

That's the whole trick. Not "leaking value" — just a choice of whose address gets to live in the results.

Which is where beginners get burned. Someone moves to a new domain, sets a 302 (usually because it was easier, or the host defaulted to it) and spends six months wondering why the old address is still the one showing up. It's showing up because you asked Google to treat the move as temporary.

Rule for life: moving for good — 301. Not sure you won't roll it back — 302.

Where you'll meet redirects even if you never set one

They're already running in your project without your help:

  • http → https. Your site gets a certificate and silently pushes everyone to the secure version (more in what is HTTPS).
  • site.com → www.site.com (or the reverse). Otherwise a search engine sees two different sites with identical content.
  • The trailing slash. /blog and /blog/ are technically different addresses. One redirects to the other.
  • Restructuring. You rename /posts to /articles — old links from other people's blogs and chats have to keep working.
  • Short links. Every URL shortener is a redirect and nothing else.

That last one is the most underrated. Someone bookmarked your page, dropped it in a chat, cited it in their post. Remove the page with no redirect and every one of those links becomes a 404. A redirect saves them.

How to see which redirect you actually have

One terminal command shows everything:

curl -I https://your-site.com/old-address

-I asks for headers only, no page body. Read the first line and Location:

HTTP/2 301
location: https://your-site.com/new-address

If it says 302 and your move is permanent, that's your fix. Where you change it depends on the host: a couple of config lines on Vercel and Netlify, a return 301 directive in nginx, a "permanent/temporary" toggle in a hosting panel.

One more thing: chains. If /a points to /b and /b points to /c, the browser walks all of it — but every hop is another request and more milliseconds. Point straight at the final address.

What to do with old pages when you move

Three situations, three answers:

  1. The page moved — 301 to the new address. The exact one, not "to the homepage."
  2. The page is gone for good, no replacement — leave the 404. It's honest, and Google drops it from the index.
  3. The page is temporarily down (you're fixing or rewriting it) — 302 to a placeholder. The index survives.

The most common mistake is redirecting everything to the homepage. For a human it's a dead end: they wanted something specific, landed nowhere, left. Search engines often treat those redirects as a soft 404 anyway.

Is it safe to use a 301 if I might change my mind?

It'll work, but slowly. Browsers cache permanent redirects for a long time — sometimes until the cache is cleared entirely. Use a 301 when the decision is final.

Do redirects slow a site down?

One hop, barely — tens of milliseconds. A chain of three or four is noticeable though, especially on mobile. More on that in how to speed up your website.

Why isn't my page in search after the redirect?

Indexing isn't instant: Googlebot has to come back and see the move. Usually weeks. If it's taking longer, the cause is probably elsewhere — see why your site isn't showing in Google.

So: a redirect is a sign, and its code is the sign's expiry date. Use a 301 where you moved for good, and every old link pointing at you keeps bringing people in.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →