diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/http/status/404 | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/http/status/404')
-rw-r--r-- | files/zh-cn/web/http/status/404/index.html | 61 |
1 files changed, 61 insertions, 0 deletions
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 +--- +<div>{{HTTPSidebar}}</div> + +<p>状态码 <code><strong>404</strong></code><strong><code> Not Found</code></strong> 代表客户端错误,指的是服务器端无法找到所请求的资源。返回该响应的链接通常称为坏链(broken link)或死链(dead link),它们会导向链接出错处理(<a href="https://en.wikipedia.org/wiki/Link_rot">link rot</a>)页面。</p> + +<p>404 状态码并不能说明请求的资源是临时还是永久丢失。如果服务器知道该资源是永久丢失,那么应该返回 {{HTTPStatus(410)}} (Gone) 而不是 404 。</p> + +<h2 id="状态">状态</h2> + +<pre class="syntaxbox notranslate">404 Not Found</pre> + +<h2 id="自定义错误页面">自定义错误页面</h2> + +<p>许多网站会将 404 页面的外观进行定制,使其对用户更友好,以及提供一些引导。例如,Apache 服务器可以在 <code>.htaccess</code> 文件中进行配置,代码片段如下:</p> + +<pre class="brush: bash notranslate">ErrorDocument 404 /notfound.html</pre> + +<p>你可以访问一下 <a href="https://developer.mozilla.org/en-US/404">MDN 的 404 页面</a>获取一些启发。</p> + +<div class="note"> +<p>自定义的404页面应该是对用户友好且可读性高的,不能使用户产生困惑。</p> +</div> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Title</th> + </tr> + <tr> + <td>{{RFC("7231", "404 Not Found" , "6.5.4")}}</td> + <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("http.status.404")}}</p> + +<h2 id="相关内容">相关内容</h2> + +<ul> + <li>{{HTTPStatus(410)}}</li> + <li> + <p>{{interwiki("wikipedia", "HTTP_404", "Wikipedia: HTTP 404")}}</p> + </li> + <li> + <p><a href="https://www.exai.com/blog/404-http-error">404 error</a></p> + </li> +</ul> |