From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/http/status/404/index.html | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 files/zh-cn/web/http/status/404/index.html (limited to 'files/zh-cn/web/http/status/404') diff --git a/files/zh-cn/web/http/status/404/index.html b/files/zh-cn/web/http/status/404/index.html new file mode 100644 index 0000000000..759fcd11c1 --- /dev/null +++ b/files/zh-cn/web/http/status/404/index.html @@ -0,0 +1,61 @@ +--- +title: 404 Not Found +slug: Web/HTTP/Status/404 +tags: + - 客户端错误 +translation_of: Web/HTTP/Status/404 +--- +
{{HTTPSidebar}}
+ +

状态码 404 Not Found 代表客户端错误,指的是服务器端无法找到所请求的资源。返回该响应的链接通常称为坏链(broken link)或死链(dead link),它们会导向链接出错处理(link rot)页面。

+ +

404 状态码并不能说明请求的资源是临时还是永久丢失。如果服务器知道该资源是永久丢失,那么应该返回 {{HTTPStatus(410)}} (Gone) 而不是 404 。

+ +

状态

+ +
404 Not Found
+ +

自定义错误页面

+ +

许多网站会将 404 页面的外观进行定制,使其对用户更友好,以及提供一些引导。例如,Apache 服务器可以在 .htaccess 文件中进行配置,代码片段如下:

+ +
ErrorDocument 404 /notfound.html
+ +

你可以访问一下 MDN 的 404 页面获取一些启发。

+ +
+

自定义的404页面应该是对用户友好且可读性高的,不能使用户产生困惑。

+
+ +

规范

+ + + + + + + + + + + + +
SpecificationTitle
{{RFC("7231", "404 Not Found" , "6.5.4")}}Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
+ +

浏览器兼容性

+ + + +

{{Compat("http.status.404")}}

+ +

相关内容

+ + -- cgit v1.2.3-54-g00ecf