0

I understand what is http code 410 (gone) vs 404 (not found) is. I am wondering if a page never existed (Wrong URI entered by the user), is it ok to return 410 instead of 404 ? I know 404 is what most sites would return in this case. Is there any harm in returning 410 ?

marcg
  • 552
  • 1
  • 8
  • 20
  • 1
    It's OK if you design it that way. But will your users understand the difference? – James Jul 04 '23 at 16:21
  • I display a generic message to the user that the page they are trying to access isn't available. Actually this is more for crawlers. I want certain pages de-indexed faster than 404 because we changed uri structure and we do not want these pages indexed anyway. – marcg Jul 04 '23 at 16:26
  • I think that, like my users comment, it would depend on the the crawler and how they each individually handle it. If it were me writing a scraper, I would use all 4XX as a 404. – James Jul 04 '23 at 16:40
  • 1
    I'd say it isn't true to say something is "gone" if it was never there to begin with. – ADyson Jul 04 '23 at 16:54
  • https://stackoverflow.com/questions/28876772/difference-between-404-and-410-error-code might be useful. – Nigel Ren Jul 04 '23 at 17:46

2 Answers2

1

To answer your question directly, there should be no 'harm' to return a 410 status code instead of a 404 status code in this scenario.

However, returning a 410 for a ressource that never existed in the first place is misleading and should not be done.

The whole point of the status code is to be as clear as possible as to why it succeeded/failed for the user who receives it. By sending a 410, the user might think this ressource once existed and might try alternative URLs to access it. By using a 404 in this context, the user will know that this ressource never existed in the first place.

XceeD
  • 101
  • 4
  • Does 404 mean the page never existed before ? I thought 404 means page is not available now but may be available later. That's why google does not de-index it immediately like in 410 For example, app server may be down and later come back online. In this case the web server would return 404 while the app server was down. – marcg Jul 04 '23 at 17:07
  • Correct, 404 does not mean the page existed or not before. 410 is used to make this difference, but otherwise its impossible to know based only on a 404. – XceeD Jul 04 '23 at 17:08
0

A 410 status code means that you deleted a page on purpose and you don’t want it back. This tells search engines to forget about that page quickly and not to bother looking for it again. A 404 status code means that you can’t find a page, but maybe it will come back later. Search engines will keep checking that page to see if it changes.

If you use 410 status code for a page that was never there, your server has to be able to handle that code and you have to be sure that you will never create that page in the future. Otherwise, you might confuse search engines and users who might wonder what happened to that page. A 404 status code is better for pages that were never there and never will be.

https://mysagaventure.com/404-vs-410-status-errors-whats-the-difference-and-how-to-fix-them/

Faizal
  • 783
  • 1
  • 6
  • 23
  • If I do re-create the page that had returned 410 and request a crawl, will it not get indexed? Can it cause lower rank ? What do you mean by "confuse search engines" ? – marcg Jul 04 '23 at 22:27