404 Not Found
HTTP 404 Not Found
用戶端錯誤回應碼,表明了伺服器找不到請求的資源。引發 404 頁面的連結,通常被稱作斷連或死連(broken or dead link)、並可以導到失效連結(link rot)頁面。
404 狀態碼並沒有表明資源是暫時不見、還是永遠不見。如果資源是永遠不見,就應該用 410 (en-US)(Gone) 而不是 404。
狀態
404 Not Found
自訂錯誤頁面
很多網站都會自訂 404 錯誤頁面,以便在指引用戶後續動作方面,提供進一步的幫助。Apache 伺服器可以透過 .htaccess
檔案設定,程式碼如下:
ErrorDocument 404 /notfound.html
要參考自訂 404 錯誤頁面範例,請看看 MDN 的 404 頁面。
適度地客製是件好事:你可以讓 404 頁面幽默和人性化,但不要讓用戶困惑。
規範
規範 | 標題 |
---|---|
RFC 7231, section 6.5.4: 404 Not Found | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content |
瀏覽器相容性
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.