The 411 on 200, 301, 404, 500

You may hear us throw around these numbers during meetings and sit there and nod and look thoughtful as you wonder to yourself “What the heck are they talking about”  Fortunately a small understanding of just a few numbers will vastly improve your knowledge of how the web works and you’ll have a great conversation starter at your next party.  Ok, not really, but you will appear smarter to your friends.

The web is built around a request/response model. When you type in www.tkg.com and hit enter, you begin the request process. That request travels the Internet and lands on our webserver.  The server then responds to that request and the loading of the webpage begins. Since there are so many variables between you and the webserver Tim Berners-Lee (the father of the web) devised this numeric code to keep both you and the server in sync to what’s actually happening.

The numbers are actually sort of a family of similar meanings with each hundreds place defining the family.

A 2xx response is a Successful response. When the server responds with a 200, its telling your browser everything is A-OK and here comes the webpage. Other 2xx codes also mean success, but vary on the conditions.

The 3xx family begins the redirection family. A 301 response tells the browser (or search engine) that what you requested has gone away, and all future requests should be directed to the specific URL. An example of this may be changing the URL www.tkg.com/danhall to www.tkg.com/dan-hall  The server will see the “danhall” request and tell the requester go to “dan-hall” instead. This is very important when dealing with SEO strategy because a search engine will transfer any ranking it built for ‘danhall’ to ‘dan-hall’.

A single webpage can make many, many, requests back to the server to load graphics, styling, and javascript needed to render the page. Transferring the same resources over and over again puts a substantial amount data on the network. Browsers have a caching mechanism built in that saves these resources locally once downloaded. Wouldn’t it make sense to use what’s just been downloaded instead of waiting for it to download again? That’s where a 304 response comes in. Its basically the server telling the client “You already have this, just use that instead”  This message is a lot smaller and quicker to get to the client instead of downloading a 1MB image for the 5th time during a web visit.

Next up is the 4xx family.  Sorry, but this group basically indicates you did something wrong.  Say you try to go to www.site.com/restricted-area A server would respond with a 401 code which means you simply aren’t allowed because you’re not authorized.  This would trigger the browser to prompt you for a user name/password which in turn the server authorizes and you get in.   Another common 4xx family member is the dreaded 404. This simply indicates that what was requested couldn’t be found.  Sites sometimes take this response and give back a sitemap, or a friendly message prompting the user to check the URL and try again.

TKG.com 404 Error PageFinally, we have the 5xx family.  Remember the web is a request/response model, right? We handled errors in the request side with the 4xx family, so the 5xx family handles errors in the response side. 500 is a generic response that something crazy happened on the server, but not additional details are available. 503 will be given back if the server is unavailable.  This may be that it is overloaded, or down for maintenance.

There you have it, a small break down of some common codes used on the web.  Next time you see a broken image, or get a picture of a broken robot instead of the latest news you’ll know you just encountered a 404 error. If you load www.facebook.com and scroll through the latest memes you can say “thank goodness for 200 responses” Well, maybe not, but hopefully this little guide has helped you demystify a small section of how the web works.

Dan’s our web programmer-in-chief, specializing in “back end” systems like Apoxe, our own custom content management system. He’s also a pretty funny guy – if anyone could make “trends in web programming” interesting, it’s Dan.

Email Dan | Read Full Bio

Leave a Reply

Your email address will not be published. Required fields are marked *

ten − 7 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>