在向用户提供用户友好内容的同时,如何为Google返回正确的404? [英] How to return proper 404 for google while providing user friendly content to the user?
问题描述
我要在此和超级用户之间回弹.如果您觉得这不属于这里,请原谅.
I am bouncing between posting this here and on Superuser. Please excuse me if you feel this does not belong here.
我正在观察此处中所述的行为-Googlebot正在请求随机网址在我的网站上,例如aecgeqfx.html
或sutwjemebk.html
.我确定我不会从网站上的任何位置链接这些URL.
I am observing the behavior described here - Googlebot is requesting random urls on my site, like aecgeqfx.html
or sutwjemebk.html
. I am sure that I am not linking these urls from anywhere on my site.
我怀疑这可能是Google在探究我们如何处理不存在的内容-引用链接问题的答案:
I suspect this may be google probing how we handle non existent content - to cite from an answer to the linked question:
[google is requesting random urls to] see if your site correctly
handles non-existent files (by returning a 404 response header)
我们为不存在的内容提供了一个自定义页面-带有样式的页面,上面写着找不到内容,如果您认为自己是错误地到达这里,请与我们联系",其中包含一些内部链接,(自然地)带有200 OK
.该URL是直接提供的(不重定向到单个URL).
We have a custom page for nonexistent content - a styled page saying "Content not found, if you believe you got here by error, please contact us", with a few internal links, served (naturally) with a 200 OK
. The URL is served directly (no redirection to a single url).
恐怕这可能会区别Google上的网站-他们可能不会将用户友好页面解释为404 - not found
,并且可能会认为我们正在尝试伪造某些东西并提供重复的内容.
I am afraid this may discriminate the site at google - they may not interpret the user friendly page as a 404 - not found
and may think we are trying to fake something and provide duplicate content.
我该如何继续确保Google在向用户提供用户友好的消息时不会认为该网站是虚假的,以防用户无意中点击了无效链接?
How should I proceed to ensure that google will not think the site is bogus while providing user friendly message to users in case they click on dead links by accident?
推荐答案
最佳做法是返回带有404响应代码而不是200的用户友好的404页面.您的Web服务器应该相对轻松地为您处理此页面.
The best practice would be to return the user friendly 404 page with a 404 response code, not a 200. Your web server should handle this for you relatively easily.
这篇关于在向用户提供用户友好内容的同时,如何为Google返回正确的404?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!