简体   繁体   中英

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.

After doing some research, I found that HTTP status 410 means 'gone permanently'. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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