English 中文(简体)
Should I use 404 Not found or 410 Gone for a bulletin board system, when a topic is deleted?
原标题:

I m creating a bulletin board system, and now I m implementing a delete topic feature for admins. If someone opens the deleted topic, the server cannot find it, so it must be 404. On the other hand, the topic has existed sometime, so I must use 410. Implementing the 410 would require a new table called deleted_topics, and so would require more space. However, 410 I think is better for search engines. What do you think? Should I use 404 or 410?

404 Not found

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.

410 Gone

The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent. Clients with link editing capabilities SHOULD delete references to the Request-URI after user approval. If the server does not know, or has no facility to determine, whether or not the condition is permanent, the status code 404 (Not Found) SHOULD be used instead. This response is cacheable unless indicated otherwise.

The 410 response is primarily intended to assist the task of web maintenance by notifying the recipient that the resource is intentionally unavailable and that the server owners desire that remote links to that resource be removed. Such an event is common for limited-time, promotional services and for resources belonging to individuals no longer working at the server s site. It is not necessary to mark all permanently unavailable resources as "gone" or to keep the mark for any length of time -- that is left to the discretion of the server owner.

Thanks,

最佳回答

Showing a 410 requires a little more effort than a 404 because to know it s a 410 you need to maintain at least a "ghost" of the former page in your database. If this is not a problem to you, I d consider the 410 "better" and "friendlier" because it presents more information. If you don t want to be hassled with maintaining a graveyard in your database, then 404 is acceptable too, of course.

I don t like Alohci s approach of redirecting to a different page. The end result looks like the user ended up on the "input new topic" page (or whatever) by accident. This works, but I think a preferable solution would be to create a custom 410 page (or 404 page, if you don t want to support 410) with specific information for the case at hand. I.e. your 410 shouldn t just say "gone", it should say "this post has been deleted, here s a link to similar posts or a link to create a new post". Your "404" wouldn t have quite as much information available but it could still offer a subset of such information and links.

I guess the "custom 410 page" comes close in appearance to "redirecting with 301" but an important difference is that robotic users of your site (of which there are many!) will get the more accurate status, and know to purge the old link from their crawl index – this will ultimately save them and you some unnecessary traffic.

问题回答

I think the correct way to do this is by sending the 410 Gone for some time and after a few weeks/months to switch to 404 Not found. Of course, it is for you to decide if that is worth the amount of time and effort.

Neither. Since you tagged your question SEO I m assuming you want the best SEO answer. If there are any backlinks (coming from outside sites) to your deleted topic all the link juice will be lost with 404 and 410 status.

Instead you should definitely create some 301 redirects which point to the root of the site, the root of the forum, or a related category. You will thus preserve the link juice and you get to decide which pages of your site will benefit most.





相关问题
How to set response filename without forcing "save as" dialog

I am returning a stream in some response setting the appropriate content-type header. The behavior I m looking for is this: If the browser is able to render content of the given content type then it ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Does HttpWebRequest send 200 OK automatically?

Background: I am implementing Paypal IPN handler. This great article on Paypal states that I am required to send a 200 OK back to Paypal after I read the response. The processing of IPN request is ...

Java HTTPAUTH

我试图把桌面应用程序连接起来,我是同D.icio.us api @ Delicious Alan书写的,简单地向他们提供我的用户名和密码,并请他把书记上写给我......。

Finding out where curl was redirected

I m using curl to make php send an http request to some website somewhere and have set CURLOPT_FOLLOWLOCATION to 1 so that it follows redirects. How then, can I find out where it was eventually ...

热门标签