301 redirects and 404 pages: what they are and when to use them
301 redirects and 404 pages: what they are, 301 vs 302 vs 307 vs 308 and 410, when to use each, how to set them up and how to avoid redirect chains.
In 30 seconds
- A 404 page says: «this page doesn't exist».
- A 301 redirect says: «this page has moved permanently, here it is» and takes the person to the new address.
- Redirect to the most similar page, not always to the homepage.
- Google follows up to 10 redirects in a row, but each hop slows things down: one hop is best. Keep redirects for at least a year.
A 301 redirect is a server instruction saying: «this page has moved permanently to a new address», which automatically takes people and Google to the new page and passes on the old page’s signals. A 404 page instead says: «this page doesn’t exist». Use a 301 when a page has a successor (a new address, a similar product), a 404 or 410 when it doesn’t.
Websites change: new products, renamed addresses, deleted pages. Each time, someone can still arrive at the old address: from a link on another site, a bookmark, Google. What they find depends on how you handled the change.
The 404 page
404 is an HTTP status code: the message the server uses to say “this page isn’t here”. A good 404 page still helps the person: it explains what happened and offers useful links (categories, search, homepage). 404 pages don’t penalise a site: it’s normal for old pages to disappear.
404, 410 and soft 404
| Case | Code | What Google understands |
|---|---|---|
| 404 Not Found | 404 | The page isn’t there; if it stays that way, it drops out of the index |
| 410 Gone | 410 | The page was removed on purpose; it drops out a little faster |
| Soft 404 | 200 | The server says “all fine” but the page is empty or says “not found”: an error to fix |
A soft 404 happens, for example, when a shop shows “Product unavailable” on an empty page with a 200 code, or when every removed page is sent to the homepage: Google treats them as not found and flags them in Search Console.
The 301 redirect
A redirect automatically sends the person (and Google) from one address to another. 301 means “moved permanently”: Google understands the new page replaces the old one and passes its signals on.
301, 302, 307 and 308: the difference
| Code | Meaning | When to use it |
|---|---|---|
| 301 | Moved permanently | Final change of address: the most used |
| 308 | Permanent, like 301, keeping the request method | Forms and APIs; for normal pages it’s equivalent to 301 |
| 302 | Moved temporarily | A page replaced for a few days (e.g. a promotion) |
| 307 | Temporary, like 302, keeping the method | Technical cases; for normal pages it’s equivalent to 302 |
For Google, permanent redirects are a strong signal that the new address becomes the canonical one; temporary ones are a weak signal. If a 302 stays in place for a long time, Google may treat it as permanent anyway.
When to use what
| Situation | What to do |
|---|---|
| The page has changed address | 301 to the new address |
| The product is replaced by a similar one | 301 to the new product |
| The product no longer exists and has no replacement | 301 to the category, or 404 |
| The page never existed (a typo) | 404 |
How to set up a 301 redirect
It depends on where the site is hosted:
- Apache server: in the
.htaccessfile, a line likeRedirect 301 /old-page/ https://www.example.com/new-page/. - Nginx server: in the configuration file, with the
return 301instruction. - WordPress: with a redirect plugin, without touching code.
- Static hosting (Cloudflare, Netlify): in a
_redirectsfile, one line per rule:/old-page/ /new-page/ 301.
This site, Peacchy, uses exactly that _redirects file on Cloudflare.
Redirect chains
When a site changes structure several times, redirects pile up: /product.php?id=12 leads to /green-teas/sencha/, which leads to /green-teas/organic-sencha/. Each hop slows the page and loses some signals. Googlebot follows up to 10 redirects in a row, then stops and reports an error. The fix is to point the first address directly to the last, and update internal links so they point straight to the final address.
How long to keep a redirect
Google recommends keeping redirects as long as possible, generally at least a year: that’s the time Google needs to transfer signals and for old external links to keep working. If other sites link to the old address, keep them forever.
How to find problems
- In Search Console, the Pages report lists “Not found (404)” pages.
- A crawler (a program that visits the whole site like Google) lists broken internal links and redirect chains.
Checklist when you change your site’s URLs
- List all old addresses (from the sitemap, Search Console, a crawler).
- Match each old address to the most similar new one.
- Set up the 301s and test them one by one.
- Update internal links, menus and the sitemap.
- In the following days, check the Pages report in Search Console.
Peacchy’s SEO Simulation has you do both: you find a 404 page with links from other sites and a redirect chain, and fix them from the shop’s admin panel.
Google’s other instructions (noindex, robots.txt, canonical) are explained in noindex, robots.txt and canonical: the differences.
Sources
The «Classic Earl Grey» product has been replaced by «Organic Earl Grey». What do you do with the old URL?
Correct! It's the page closest to what the person was looking for: anyone arriving from the old link finds the new product straight away.
Not quite. A 404 loses people arriving from old links; the home page makes them search again, and Google may treat that redirect as a 404.
Frequently asked questions
Do 404 errors hurt SEO?
No. It's normal for old pages to disappear. The problem is losing visitors and links that pointed to a moved page: that's what 301s are for.
301 or 302?
301 when the move is permanent, 302 when it's temporary (a few days). For Google a 301 is a strong signal that the new address becomes the main one.
Should I redirect every deleted page to the homepage?
No. Google treats mass redirects to the homepage as soft 404s. Redirect to the most similar page, or let it return a 404 or 410.
Topics:SEOTechnical SEO