DEV Community

MD Pabel
MD Pabel

Posted on • Originally published at mdpabel.com on

404 vs 410: Why Google Won’t Forget Your Deleted Pages

You deleted a page on your website. Maybe it was an old product, or maybe it was a virus file from a hack.

You deleted it, so it should be gone, right?

Wrong.

You check Google a week later, and the page is still there in the search results. When people click it, they see an “Error Page.” This is bad for your reputation and your SEO.

Why does Google keep listing pages you deleted? The answer lies in the difference between a 404 code and a 410 code.


The Mailman Analogy

Imagine Googlebot (the robot that scans your site) is a Mailman , and your website pages are Houses.

1. The 404 Not Found (The “Nobody is Home” Error)

When you delete a page normally, your server usually gives a 404 Error.

  • What it tells the Mailman: “I knocked on the door, but nobody answered.”
  • What the Mailman thinks: “Hmm, maybe they are just on vacation? Maybe the bridge is out? I will come back tomorrow and check again. And I’ll check next week, too.”

Google treats a 404 as a temporary error. It assumes you might have made a mistake and that the page might come back. So, Google keeps the link in its search results for a long time, “just in case.”

2. The 410 Gone (The “Moved Away” Sign)

A 410 Error is very different. It is a strict rule.

  • What it tells the Mailman: “There is a sign on the door that says ‘This house has been demolished.’
  • What the Mailman thinks: “Oh, okay. This house is gone forever. I will cross it off my list and never come back.”

When you use a 410 code, Google immediately removes that URL from its search index. It knows there is no point in checking it again.


Why This Matters for Hacked Sites

If your site was hacked with the “Japanese Keyword Hack” or “Pharma Hack,” the virus likely created 50,000 fake pages on your site.

If you just delete them and serve a 404 :

  1. Google will come back and try to crawl those 50,000 links again and again.
  2. Your server will slow down because it is busy talking to Google about 50,000 missing pages.
  3. Your “clean” pages won’t get ranked because Google is wasting time on the bad ones.

If you serve a 410 :

  1. Google visits once, sees the “Gone” sign, and deletes the link.
  2. Your “Crawl Budget” is saved for your real content.
  3. The spam links disappear from search results much faster.

Summary: When to Use Which?

Situation Use This Code Why?
You moved a page 301 Redirect Sends users to the new location.
You made a mistake 404 Not Found You might fix it later.
Malware / Spam Pages 410 Gone Kill it forever. Save your SEO.

Top comments (0)