HTTP Status Codes Explained

HTTP status codes are sent by the server in response to a HTTP request, it is common to log and examine the status code of a request to help identify the cause of an error message you are seeing, check your visitors are not seeing errors and/or improve performance.


Where to find http status code

In the server’s websites log files (what the server sends): Follow the instructions to enable http(s) request logging, statistics along with how to access and open log files for your websites.

In web browsers or wget clients (what the client receives):

Log files examples with status codes

[IP] – – [DATE] – [METHOD] [URL] [HTTP_VERSION] [STATUS_CODE] [REQUEST_SIZE] “[REFERER]”
123.123.123.123 – – [04/Jun/2014:03:30:47 +0100] “GET /wp-content/themes/pipeten2/images/pipeten.gif HTTP/1.1” 200 1332 “/”
123.123.123.123 – – [04/Jun/2014:03:31:26 +0100] “GET /wp-content/themes/pipeten2/images/pipeten.gif HTTP/1.1” 304 – “/”
123.123.123.123 – – [04/Jun/2014:03:40:21 +0100] “GET /doesnotexist HTTP/1.1” 404 27826 “-”
123.123.123.123 – – [04/Jun/2014:03:44:00 +0100] “GET /r/update-cc/ HTTP/1.1” 302 – “-”
123.123.123.123 – – [04/Jun/2014:03:44:00 +0100] “GET /index.php/2007/05/how-do-i-update-my-credit-card-details-in-the-control-panel/ HTTP/1.1” 301 – “-”
123.123.123.123 – – [04/Jun/2014:03:44:00 +0100] “GET /2007/05/how-do-i-update-my-credit-card-details-in-the-control-panel/ HTTP/1.1” 200 43702 “-”
123.123.123.123 – – [04/Jun/2014:03:47:36 +0100] “GET /denied/ HTTP/1.1” 403 292 “-”

Common HTTP status codes

200 – OK
A good thing to see, status 200 means that the request completed successfully and the content served.

301 – Moved Permanently
Only seen when redirected by code or web server configuration, usually followed by another request from the same visitor hitting the correct content. Use when you want the visitor / spider / search engine to forget this URL and just index the new, for example when you move or rename a page.

302 – Found (Moved Temporarily)
Only seen when redirected by code or web server configuration, usually followed by another request from the same visitor hitting the correct content. Use when you still want the visitor / spider / search engine to try index the original URL, for example when doing maintenance on a page.

304 – Not Modified
A good thing to see, identical to status 200 except that the content is not re-delivered (because it has not been modified since the last cached request). This is a reasonably good indication that the server is sending expires headers and browsers are correctly caching non changed content.

307 – Temporary Redirect
Intended to replace the 302 status (more restrictive than 302, not support in <HTML/1.1 clients).302).

308 – Permanent Redirect
Intended to replace the 301 status (more restrictive than 301, not support in <HTML/1.1 clients).

400 – Bad Request
Not something you should see frequency, most typically a problem with code or web browsers interpretation of the code and then sending a bad or malformed request the web server could not understand.

401 – Unauthorized
On visiting a password protected file or directory (through .htaccess/htProtect/htAuth or other similar method) and entering an incorrect username/password combination, you will get this status code.

403 – Forbidden
When access is explicitly denied to the URL / resource / script, most typically due to .htaccess or IIS restrictions.

404 – Not Found
A common http status code, 404 occur when the resource requested cannot be found. The cause is often either due to failed FTP upload or incorrect path / URL to the resource.

418 –  I’m a teapot
Yes, that really is a http status code (RFC 2324), sadly we have not found a justifiable use for it in the Pipe Ten infrastructure, perhaps when we make our IPv6 kettle.

500 – Internal Server Error
There has been an error processing the request, this can be due to an error in the script, too many resources being requested or server side error.

503 – Service Unavailable
There has been an error processing the request, this is can due to excess resources being requested or a server side error.

Full list of http status codes

For a full list of http status codes, please see Wikipedia summary and W3 RFC2616 section 10. The CloudFlare ones from Wikipedia may be useful to some.


If you are unsure why you are receiving a specific http status code, please raise a ticket with the support team providing log samples or steps to repeat the problem and we’ll do our best to explain or provide further debug assistance.


Rate this post 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

This entry was posted in Linux & PHP, Tips & Tricks, Tutorials, Windows, ASP & .NET and tagged , . Bookmark the permalink.

Leave a Reply

Please DO NOT use this form to submit support requests, all information submitted will be PUBLICLY VISIBLE.

Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.