What a redirect is and when a small site needs one
What does a redirect actually do?
A redirect sends a visitor from one web address to another, automatically. You type or click the old address, and the page that loads is the one at a different address. Most people never notice.
Behind the scenes it's a short exchange. The browser asks a server for a page. The server doesn't hand over the page. It sends back a short reply instead: it lives somewhere else. The reply carries a status code that starts with 3 and a Location header holding the new address1. The browser then loads that new address straight away1.
MDN is Mozilla's web documentation. It describes the idea as a way to give more than one URL address to a page, a form, a whole website, or a web application1. A URL is just a web address. Google puts it more plainly: a redirect tells your visitors and Google Search that a page has a new location2.
Will visitors notice a redirect?
Usually not. There's a small cost, because the browser makes an extra trip to the server, but MDN says users rarely notice the redirection1.
That small cost adds up if you pile redirects on top of each other. MDN says their use should be kept to a minimum1. So a redirect is a fix for a real problem, not something to scatter around a site "just in case".
When does a small site actually need one?
Here are the situations the sources name.
- You changed a page's address. Other websites, bookmarks and search results still point at the old one. MDN says you don't want to break these links, as they bring valuable users1. The page on redirecting after a rebuild walks through this.
- Your site can be reached in more than one way. Google gives the example of one home page reachable through
https://example.com/home,http://home.example.comorhttps://www.example.com. It suggests picking one as the preferred address and redirecting the rest to it2. See www or no www. - You want the secure version of your site used. Requests to the
http://version of your site can redirect to thehttps://version1. The http to https page covers it. - You moved to a new domain. Google lists moving to a new domain as one of the main uses2.
- You merged two websites. Links to outdated addresses can then be sent to the correct pages2.
- You removed a page and want to send people to a new one. Google names this too2.
If none of those fit, you probably don't need a redirect. A page that never moved doesn't need one.
Is a redirect the same as a broken link fix?
Not quite. A redirect repairs the old address. It doesn't repair the links on your own pages. MDN advises that you avoid internal redirects where you can, because each one costs an extra request, and says to fix your own links instead1.
So the order is simple. Redirect the old address for the outside world. Then update your own links to point at the new address, so your own visitors skip the detour.
Do I have to write the redirect myself?
Not always. Google notes that if you use a platform such as Blogger or Shopify, the platform may already have built-in redirect tools, and suggests searching its help articles2. Check your platform's own documentation first.
If you run your own server, the redirect goes in the server's settings or in a small script. There are permanent and temporary kinds, and the choice matters; the types of redirect page covers it2. After you set one up, check where it really goes.
Are there redirects that aren't from the server?
Yes. MDN lists two other ways. One is a <meta> tag in the page's HTML. The other is JavaScript that sets the page's location1.
Both have limits. The HTML kind only works on HTML pages, and the JavaScript kind only works for visitors whose browsers run JavaScript1. MDN says to use a server redirect when you can, and not to add a <meta> redirect on top of it1.
Further reading and sources
- Redirections in HTTP, MDN Web Docs (Mozilla)
- Redirects and Google Search, Google Search Central