What is a redirect, and why do pages need them?
What actually happens when someone clicks an old link?
The visitor's browser asks your server for the old address. If you've set up a redirect, the server doesn't send the page. It sends a short reply that means "look over there instead", and the browser goes to the new address by itself.
A redirect, then, is a signal that a page has a new location. Google puts it as telling your visitors and Google Search that a page has a new location.1
Under the hood, the reply is a status code (a short number the server sends with every answer) that starts with 3. It comes with a Location header, which holds the new address.2 The browser then loads that address straight away.2
Will my visitors notice?
Hardly ever. MDN says users rarely notice a redirect.2 There's one small cost: the browser makes an extra trip to your server, so the page can take a touch longer to appear. That's why you'd rather not stack redirects on top of each other. The page on redirect chains and loops covers it.
What if I don't set one up?
Then the old link points at nothing. The server replies with a "404 Not Found" error, and the visitor sees an error page instead of your content.3
MDN lists mistyped addresses, and pages that were moved or deleted without a redirect, among the common causes of these errors.3 Links that lead to such a page are often called broken or dead links.3 Notice that a 404 only says the page is missing. It doesn't say whether that's for now or for good.3
Who still uses the old address?
More people than you'd guess. Even if you fix every link on your own site, you can't reach into other people's pages, emails and bookmarks. MDN makes the same point: you have no control over the URLs used by external resources.2
That's the main job of a permanent redirect. MDN describes it as a way to preserve existing links and bookmarks after you change a site's URLs.2
When do site owners use redirects?
Google lists four common situations.1
- You've moved your site to a new domain (the name part of the address, such as
example.com). - People reach the same page through several addresses, and you want to pick one as the preferred address.
- You're merging two websites, and links to old addresses should land on the right new pages.
- You removed a page and want to send visitors to a new one.
Not every deleted page needs one. The page on when you need a redirect sorts out which cases do.
Do I have to write code?
Often not. Google says that platforms such as Blogger or Shopify may already have built-in redirect tools, and suggests searching the platform's help articles.1 If you run your own server, the setup page shows what a rule looks like.
Two kinds of redirect come up again and again: permanent and temporary. Visitors generally can't tell the types apart.1 301 and 302 redirects explains why the choice still matters.
Cited material
- Redirects and Google Search, Google Search Central
- Redirections in HTTP, MDN Web Docs (Mozilla)
- 404 Not Found, MDN Web Docs (Mozilla)