httpステータスコード一覧

作成日:2018-02-14, 更新日:2018-08-03

Informational 1xx

100 Continue
101 Switching Protocols

Successful 2xx

200 OK 表示できたとき。基本、ページが表示されるとき。例外はあるかもしれない。
201 Created
202 Accepted
203 Non-Authoritative Information
204 No Content
205 Reset Content
206 Partial Content

Redirection 3xx

300 Multiple Choices
301 Moved Permanently リダイレクト(サイトの引越など恒久的にリダイレクト)
302 Found 一時的にリダイレクト(メンテナンス中などのときに一時的に別ページにリダイレクトさせるとき)
303 See Other
304 Not Modified
305 Use Proxy
306 (Unused)
307 Temporary Redirect

Client Error 4xx

400 Bad Request 不正なURL系。getパラメータがおかしいとき・・・?
401 Unauthorized ユーザー認証が必要なページを表示しうようとしたとき(※ユーザー認証失敗時)
402 Payment Required
403 Forbidden アクセス拒否。権限が無いときなど
404 Not Found ファイルが見つからないとき
405 Method Not Allowed
406 Not Acceptable リクエストされた内容の条件が間違っている
407 Proxy Authentication Required
408 Request Timeout
409 Conflict リクエストに従うと現在の状態で衝突するからダメ
410 Gone
411 Length Required
412 Precondition Failed リクエストの条件を満たしてない
413 Request Entity Too Large
414 Request-URI Too Long
415 Unsupported Media Type
416 Requested Range Not Satisfiable
417 Expectation Failed

Server Error 5xx

500 Internal Server Error プログラム側でエラー
501 Not Implemented
502 Bad Gateway
503 Service Unavailable システムメンテナンスのときも503。
504 Gateway Timeout
505 HTTP Version Not Supported

めも

個人的に下記のような感じかなぁ・・・と、そのメモ

401 ログインエラー
403 データが無い
404 ページが無い
406 バリデーションエラー、リクエストされたレコードが「無効データ(ex. status=0)」でエラーにするとき
409 メアド重複、登録済みデータを新規登録しようしたとき
412 認証キー、チェックサムが一致しない
500 DB接続失敗、更新、削除などの失敗

403と406の違い

下記のような感じで使い分ける・・・ということかな?
・「【ID=5】のデータが欲しい」→「【ID=5】のデータは無い」→406
・「【ID=5】のデータを加工する」→「【ID=5】のデータは無いから加工は無理」→403

関連項目

FTPステータスコード一覧表