how to set content for 404 pages?

   1. Create the new error pages.
   2. Add the custom pages to the Configuration > Site information
   3. Enter your new paths into the 403 and 404 error page.
   4. Click "Save configuration".
   For D7 settings are under Site Information at /admin/config/system/site-information

Programmatic Method:
Drupal 7:
custom templates for 403, 404 pages you only need to include this code in your theme template.php and create your templates page-403.tpl.php and page-404.tpl.php:

<?php
function mytheme_preprocess_page(&$vars) {
    // HACK: Use custom 403 and 404 pages
    if (strpos(drupal_get_headers(), '403 Forbidden') !== FALSE) {
        $vars['template_files'][] = "page-403";
    }
    if (strpos(drupal_get_headers(), '404 Not Found') !== FALSE) {
        $vars['template_files'][] = "page-404";
    }
}
?>

Drupal 8:
<?
/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function THEMENAME_theme_suggestions_page_alter(array &$suggestions, array $variables) {
  $request = \Drupal::request(); // Get Request Object.
  // If there is HTTP Exception..
  if ($exception = $request->attributes->get('exception')) {
    $status_code = $exception->getStatusCode();// Get the status code.
    if (in_array($status_code, array(401, 403, 404))) {
      $suggestions[] = 'page__' . $status_code;
    }
  }
}
?>

Tags