Back to blog
Engineering

How URL shorteners work (and why 302 beats 301 for short links)

Zayd
Nov 19, 2026·6 min read

You tap a short link in a group chat, and a moment later you're looking at a product page. It feels like nothing happened in between. In fact a small chain of events ran across the internet, and each step decides something: how fast the page appears, whether anyone can count the visit, and whether the link can be fixed if it pointed at the wrong place.

If you share links for a living, it's worth knowing what that chain looks like. This is the plain-English version. You don't need a networking degree, but we won't skip the parts that matter.

A short link is a pointer, not a page

A short link like trims.app/spring has no content of its own. Behind it sits a single record in a database: the code spring, and the full address it stands for, which might be a 140-character URL with tracking tags hanging off the end. The shortener's whole job is to answer one question as quickly as possible. When someone asks for spring, where should they go?

Everything else a link platform does, from analytics to QR codes to routing rules, is built around that one lookup.

What happens when someone taps it

  • Finding the server. The phone asks DNS, the internet's address book, where trims.app lives. The answer is usually already cached nearby, so this takes a few milliseconds.
  • Asking for the code. The browser requests /spring. The request first reaches a server close to the person tapping, which passes it on to ours.
  • Looking it up. We check the code against a cache held in memory. Only if it isn't there do we ask the database, and the answer is kept for the next request.
  • Sending the redirect. The server replies with a tiny response that says, in effect, what you want is over there, along with the full destination address.
  • Following it. The browser reads that reply and goes to the destination. This is the moment the person sees your page.

The redirect itself is only a few hundred bytes: a status code, a Location header with the destination, and a couple of instructions about caching. That small reply is where the most important decision lives.

301 or 302: the choice that decides whether you can count clicks

Redirects come in a few types, and two of them do most of the work. A 301 says the move is permanent. A 302 says it's temporary. To the person tapping, they look identical. To a browser they are very different instructions.

When a browser sees a 301, it's allowed to remember the answer. The next time the same person taps that short link, the browser can skip the shortener entirely and go straight to the destination from memory. That's good for speed and bad for the two things people actually want from a short link.

  • Counting. If the browser never asks the shortener again, the shortener never sees the repeat clicks, and your numbers quietly drift low.
  • Editing. If you fix a typo in the destination or point the link at a new page, anyone whose browser remembered the old answer keeps landing on the old address.

That's why TRIMS answers every short link with a 302 and tells browsers not to store it. Each tap comes back to us, gets counted, and goes wherever the link points right now. You can change a destination after the link is printed on ten thousand flyers, and the very next scan follows the new address.

A permanent redirect is a promise that the destination will never change. Short links exist precisely because things change.

Do short links hurt SEO?

This is the question we hear most, and the honest answer is: not in the way people fear. Search engines follow redirects and credit the page at the end of them, and Google has said publicly that redirects, temporary ones included, don't throw away ranking value. What matters far more is that the destination is a good page and that it isn't buried behind a long chain of hops.

Where SEO and redirects really meet is on your own website. If you're moving a page to a new address for good, use a 301 on your web server, because that is a permanent move and should be described as one. Short links are a different tool. They're for sharing, measuring and changing your mind later.

Why some short links feel slow

When a short link feels sluggish, the shortener is rarely the main cost. The usual culprit is a chain: a short link pointing at another short link, which points at an ad tracker, which redirects from http to https, which then adds www. Each hop is another round trip, and on a weak mobile signal each one can cost a few hundred milliseconds.

  • Point the link at the final address. If your page lives at https://www.example.com/shoes, use exactly that, not example.com/shoes.
  • Don't shorten a short link. Two shorteners in a row means two lookups and two sets of numbers that will never agree.
  • Keep tracking in one place. Add your UTM tags to the destination once rather than stacking trackers on top of each other.
  • Test on mobile data, not office Wi-Fi. That's where most of your clicks come from.

One more thing that catches people out: VPNs. If you test your own links while connected to a VPN, your request may travel to another country and back before it reaches the link. The link isn't slow; the detour is.

What gets recorded when someone clicks

Counting happens after the redirect is sent, not before. The person is already on their way when we write the click down, so analytics never slow anyone down. From the request we can tell roughly where it came from (country and city), what kind of device sent it, which app or site referred it, and whether it looks like a person or an automated bot. None of that tells us who the person is.

It's also why the clicks on a short link rarely match the visits your website reports. A click is counted the moment someone taps; a visit is only counted if the page finishes loading and its analytics script is allowed to run. We've written a separate guide on why those two numbers never quite agree.

Is it safe to click a short link?

Short links hide their destination, which is exactly why scammers like them. A responsible shortener checks where its links go. TRIMS checks every destination against regularly refreshed lists of known phishing and malware sites, again on each click, and a link that points somewhere dangerous shows a warning page instead of sending the visitor straight there.

On the receiving end, the old advice still holds: if a link arrives from someone you don't know, with a message that feels urgent, don't tap it.

That's the whole trick, really. One fast lookup, a well-chosen redirect, and the discipline to keep everything else out of the way. Get those right and a short link stays invisible, which is exactly how it should feel.

Zayd
Founder & Engineer, TRIMS

Building TRIMS — a fast, honest link platform with analytics that actually help you decide.

Next up
UTM parameters explained: a simple guide to tracking every campaign