Saturday 10 May 2008

301 - 301, 404, 500 What does it all mean?

I started thinking about the world and me heddy days as a cicso bod, yes I was a network engineer, I hold the coverted CCNP for my sins.

Now I have heard lots of talk in my current world of development about what response codes mean, from both a code point of view and a web SEO (search engine optimisation) point of view.

The normal thing to happen when a request for website or web object is made is that the server will give a response, and the response is a number reflecting the state of the intended destination.

We have all heard of the dreaded 404 - page not found.

The Response Codes

The response codes start at 100 and go up to 500. I am going to give an overview of the meaning of the most common types.


Note 1## means the 100 range.

1## - Anything in this range is purely an informational response and tells you the destination can receive a request. This is a part response and normally occurs dur to proxy before another response is returned.

2## - This means you had a successful response.
  • 200 - Success - request was successful

The 200 response is the most likely success response, but there are also the following success responses

  • 201 -Response was created succesfully
  • 202 - Response was accepted.
  • 203 - Response was successfuly but is non-authoritative.
  • 204 - Response was successful but is enpty of content.
  • 205 - Response was successful but the content sent has been reset.
  • 206 - A partial response, only part of the content was returned.
  • 207 - Successful but a multi status response, i.e in parts.

3## - This is a redirection, the client browser needs to do further action to reach content

This response is the most likely one to cause issues with your website in the search engines, if you are moving your website you should carryout a permanent redirect.

  • 301 - Resource has moved permanently from this location (this redirection is normally done within the server software, not in the coding on the server)

There are other 300 response codes that you should be aware of

  • 302 - Resource has been moved, this is seen as a temporary redirect (mornally done in server code)
  • 304 - The resource is not modifed and neither is the path to it, normally seen by search engines when you use any proxy.
  • 307 - Resource has been moved but only temporarily (normally done in server code)

One note on the redirection responses codes, it is better to do a 301 redirect, that is do it with the server.

To do a permanent 301 redirect - the one the search engines like.

In IIS

  1. 1. Go into IIS Manager
  2. Expand you website list and go into the properties for the site you want to redirect
  3. Click on the Home Directory Tab
  4. Select the A Redirection to a URL option
  5. Enter the new URL in the Redirect to box (including http://)
  6. Tick the exact URL entered above box
  7. Tick the A permanent redirection for this resource box
  8. Click Apply


















This mean you have permanently moved your website. If you do not select the permanent redirect option, the redirection will be seen as a temporary redirect or a 302.

4## - This mean a client error has occurred, such as it cannot find or get to where it was heading, and is most commonly cause by an incorrect link or a typo.

The most common type of 400 error is the 404.
  • 404 - Page Not Found or resource not found

There are alot of 400 errors that can occur but the other most common ones other than 404 are

  • 400 - this is a bad request
  • 401 - Access Denied - the client cannot access the resource because of credentials given
  • 403 - This means the client cannot access the resource as it is forbidden to do so, normally caused by either a file error or IP restriction problem, or if your lucky just too users accessing your website at one time.
  • 406 - client browser does not support server MIME type, can occur dut to old browsers

5## - This is a server error, most commonly due to coding problems

The most common 500 error is

  • 500 - Internal server error - probably an error in the website code

About response codes

There are lots of error codes and this blog is aimed at giving you an idea of the most common ones and the causes of them.

Checking for response codes

If you are listening for a response code to be returned, teh best way is jsut to listen for the parent response, such as checked for a 200 reponse for a successful request.

Search Engine Listing and Redirection

The main things to take into consideration are when moving your website, and follow the instructions above to help you with your search engine listings, if you are moving your website make sure you do a 301 redirection.




Thanks
Sean J Connolly
Visit AJAX Web Development Store



DMS - Document Management, Webmail
BuzzProperties.co.uk - Online Property Sales and Letting



No comments:

Online Cashback