简体   繁体   English

我应该使用HTTP状态代码410来删除网站上的库存吗?

[英]Should I use HTTP Status code 410 for removed stock on a web site?

I'm building a site for a motorcycle dealer, and their used stock changes daily. 我正在为摩托车经销商建造一个场地,他们的旧库存每天都在变化。 Currently, when stock is removed, Google Webmaster tools sees Error 404, which I should imagine would damage the reputation of the site with Google. 目前,当删除股票时,Google网站管理员工具会看到错误404,我认为这会损害Google网站的声誉。

After doing some research, I found that HTTP status 410 means 'gone permanently'. 在做了一些研究之后,我发现HTTP状态410意味着“永久消失”。 Should I be using this status code for requests to bikes which are no longer in stock? 我是否应该使用此状态代码来请求不再有货的自行车? The page gives a message to say that the bike has been sold, and shows a list of other used stock, just wondering what the correct way of handling these would be. 该页面给出了一条消息,说明该自行车已售出,并显示其他二手货的清单,只是想知道处理这些货物的正确方法是什么。

Thanks in advance 提前致谢

The status code should refer to the representation of the resource, not the availability of the resource itself. 状态代码应该引用资源的表示,而不是资源本身的可用性。 So a page listing an item that is no longer available should still return a 200 status, not 404 or 410. 因此,列出不再可用的项目的页面仍应返回200状态,而不是404或410。

Then you can list a message on the page saying 'this item is no longer available'. 然后,您可以在页面上列出“此项目不再可用”的消息。 This is similar to how Amazon and eBay handle this problem. 这与亚马逊eBay处理此问题的方式类似。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM