aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/http/status/404/index.html
blob: 0e7051452f69e74869ae021e51fa58c12840a0d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: 404 Not Found
slug: Web/HTTP/Status/404
translation_of: Web/HTTP/Status/404
---
<div>{{HTTPSidebar}}</div>

<p>HTTP <code><strong>404 Not Found</strong></code> 用戶端錯誤回應碼,表明了伺服器找不到請求的資源。引發 404 頁面的連結,通常被稱作斷連或死連(broken or 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>要參考自訂 404 錯誤頁面範例,請看看 <a href="https://developer.mozilla.org/zh-TW/404">MDN 的 404 頁面</a></p>

<div class="note">
<p>適度地客製是件好事:你可以讓 404 頁面幽默和人性化,但不要讓用戶困惑。</p>
</div>

<h2 id="規範">規範</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">規範</th>
   <th scope="col">標題</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", "維基百科的 HTTP 404")}}</p>
 </li>
 <li>
  <p><a href="https://www.exai.com/blog/404-http-error">404 Error </a></p>
 </li>
</ul>