Skip to content
tinbo
Blog

Engineering4 min read

301 vs 302: which redirect should a short link use?

A short link is one HTTP response with a status code and a Location header. Which code it sends decides whether browsers remember it, whether your clicks get counted, and whether you can ever change where it goes.

tinbo team

In this post
  1. The four redirect codes
  2. Why "permanent" is a strong word
  3. What about SEO?
  4. When a link does more than redirect
  5. How tinbo handles it

Strip a short link down and there is very little left. A browser asks for acme.inbo.to/spring, the server answers with a status code and a Location header, and the browser goes there instead. That answer is the whole product.

Here is what it looks like on the wire, trimmed to the parts that matter:

curl -sI https://acme.inbo.to/spring
HTTP/2 302
location: https://example.com/spring-sale?utm_source=sms
cache-control: no-store

Three lines. The interesting one is the first, because the status code is a promise about how long this answer stays true.

The four redirect codes

CodeNameWhat it promisesKeeps a POST a POST?
301Moved PermanentlyThis address has moved for goodNo
302FoundGo there for now, ask me again next timeNo
307Temporary RedirectSame as 302Yes
308Permanent RedirectSame as 301Yes

The 307 and 308 codes exist because, historically, browsers turned a redirected form submission into a plain page request. 307 and 308 forbid that. A short link is almost always clicked, never posted to, so for links 302 and 307 behave the same, and so do 301 and 308.

That leaves one real decision: permanent or temporary.

Why "permanent" is a strong word

A permanent redirect tells everyone who sees it that the old address is finished. Browsers are allowed to believe you. Unless the response says otherwise, a browser may store a 301 and, next time someone opens the short link, skip the server entirely and go straight to the destination it remembers.

For a short link, that has three consequences:

  1. The click isn't counted. The request never reaches the link server, so there is nothing to record.
  2. Edits don't reach that browser. Change the destination tomorrow, and anyone whose browser kept the old answer keeps going to the old page.
  3. Rules stop applying. Sending visitors to different pages by country or device, or splitting traffic between two pages, only works when every visit is asked about afresh.

A 302 makes no such promise, so browsers come back to the server every time. That is what a link you might want to measure or change needs.

What about SEO?

Google follows both kinds. Its guidance treats a permanent redirect as a strong hint that the destination is the page to show in search results, and a temporary one as a weaker hint. Both pass the link's value along.

For links shared in posts, messages, emails and print, this rarely matters: nobody wants the short link itself to rank. It starts to matter when a short link stands in for a page for good — an old campaign URL that now points at its permanent home, say, and that other sites link to. That is the case for a 301.

The redirect type only decides the plain hop from the short link to its destination. A link with extra settings doesn't always answer with that hop, and when it doesn't, the setting has nothing to apply to. On tinbo:

SettingWhat the visitor getsRedirect type applies?
Country, device and A/B rulesA redirect to whichever destination the rules pickedYes
Password protectionA password page first; once it's unlocked, the redirectYes, after the password
Open in app, on a phoneAndroid: a hand-off straight into the app. iPhone: a small page that opens the app, with a browser fallbackNo
Open in the default browser, in Android in-app browsersA hand-off that reopens the page in the visitor's own browserNo
A custom social preview, for crawlersThe preview card itself; no redirect at allNo
Expiry, once the link has expiredA temporary redirect to your "expired" page, or a plain "gone"No, always temporary

Everyone else — computers, and phones when the destination isn't an app tinbo knows — gets the plain redirect, with the type you picked.

Every row also depends on the request reaching the server. A browser holding on to a stored permanent redirect would walk straight past the password page, never be offered the app, and keep following the link after it expired. Passwords, app opening and expiry are three more reasons for a link to be asked about afresh on every visit.

How tinbo handles it

New links on tinbo redirect with a 302. You can switch any link to 301, 307 or 308 under Advanced → Redirect type if you need to.

Every redirect tinbo sends also carries Cache-Control: no-store, whatever the code. It asks browsers not to keep the answer at all, so even a link set to 301 is looked up on each visit by browsers that respect the header, which modern ones do. Counting, edits, rules, passwords and app opening keep working; the 301 still tells search engines that you mean it.

One response, three lines. It's worth getting the first one right.

Keep reading

Your first link is one minute away

Sign up, get you.inbo.to, paste a URL. Free to use, no card, no time limit.