Add body classes to 404 and 403 error pages
For anyone working with Drupal 7, the function names and the way you pass variables are a bit different. The D7 solution for a 404 would look like this:

function MYMODULE_preprocess_html(&amp;$variables) {
  $headers = drupal_get_http_header();

  if (isset($headers['status']) &amp;&amp; $headers['status'] == '404 Not Found') {
    $variables['classes_array'][] = 'page-404';
  }
}


The drupal_get_headers() function from D6 is now drupal_get_http_header() in D7. The values returned are structured a bit differently. You can view the contents of the array with "dpm($headers);" if you're using the devel module.

Finally, additional class variables can be added as elements of the $variables['classes_array'] by assigning them to an empty index, which will then be added to the html body tag via the template_process() function.