diff --git a/var/www/drupal8/sites/all/modules/customerror/config/customerror.config.yml b/var/www/drupal8/sites/all/modules/customerror/config/customerror.config.yml
new file mode 100644
index 0000000..883d407
--- /dev/null
+++ b/var/www/drupal8/sites/all/modules/customerror/config/customerror.config.yml
@@ -0,0 +1,9 @@
+customerror_403:
+  title: 'access denied'
+  body: 'access denied'
+  theme: ''
+customerror_404:
+  title: 'requested page not found'
+  body: 'requested page not found'
+  theme: ''
+customerror_redirect: ''
diff --git a/var/www/drupal7/sites/all/modules/customerror/customerror.info b/var/www/drupal7/sites/all/modules/customerror/customerror.info
deleted file mode 100644
index 9ed6739..0000000
--- a/var/www/drupal7/sites/all/modules/customerror/customerror.info
+++ /dev/null
@@ -1,13 +0,0 @@
-name = Custom Error
-description = Enables the creation of custom error pages for 404 and 403 errors, as well as redirects for 404s.
-core = 7.x
-configure = admin/config/system/customerror
-
-files[] = customerror.test
-
-; Information added by drupal.org packaging script on 2013-06-30
-version = "7.x-1.0"
-core = "7.x"
-project = "customerror"
-datestamp = "1372604452"
-
diff --git a/var/www/drupal8/sites/all/modules/customerror/customerror.info.yml b/var/www/drupal8/sites/all/modules/customerror/customerror.info.yml
new file mode 100644
index 0000000..08f3c67
--- /dev/null
+++ b/var/www/drupal8/sites/all/modules/customerror/customerror.info.yml
@@ -0,0 +1,6 @@
+name: Custom Error
+type: module
+description: 'Enables the creation of custom error pages for 404 and 403 errors, as well as redirects for 404s.'
+core: 8.x
+version: 8.x-1.0
+configure: customerror.module_settings
diff --git a/var/www/drupal7/sites/all/modules/customerror/customerror.install b/var/www/drupal7/sites/all/modules/customerror/customerror.install
deleted file mode 100644
index f960a0a..0000000
--- a/var/www/drupal7/sites/all/modules/customerror/customerror.install
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/**
- * @file
- * Install, update and uninstall functions for the customerror module.
- */
-
-/**
- * Implements hook_uninstall().
- */
-function customerror_uninstall() {
-  db_delete('variable')
-    ->condition('name', 'customerror_%', 'LIKE')
-    ->execute();
-
-  // @todo document, why manually loading .module file.
-  module_load_include('module', 'customerror');
-  foreach (_customerror_enum_errors() as $code => $desc) {
-    if (variable_get('site_' . $code, '') == 'customerror/' . $code) {
-      variable_del('site_' . $code, '');
-    }
-  }
-}
diff --git a/var/www/drupal8/sites/all/modules/customerror/customerror.menu_links.yml b/var/www/drupal8/sites/all/modules/customerror/customerror.menu_links.yml
new file mode 100644
index 0000000..6e79482
--- /dev/null
+++ b/var/www/drupal8/sites/all/modules/customerror/customerror.menu_links.yml
@@ -0,0 +1,6 @@
+customerror.module_settings:
+  title: Custom Error
+  description: 'Enables the creation of custom error pages for 404 and 403 errors.'
+  route_name: customerror.module_settings
+  parent: system.admin_config_system
+  menu_name: admin
diff --git a/var/www/drupal7/sites/all/modules/customerror/customerror.module b/var/www/drupal8/sites/all/modules/customerror/customerror.module
index db689a8..c8a16a9 100644
--- a/var/www/drupal7/sites/all/modules/customerror/customerror.module
+++ b/var/www/drupal8/sites/all/modules/customerror/customerror.module
@@ -1,42 +1,11 @@
 <?php
 
-// Copyright 2005 Khalid Baheyeldin http://2bits.com
-
-
 /**
  * @file
  * Enables custom 404 (not found) and 403 (access denied) pages in Drupal
- * with no need for creating real nodes under taxonomies
+ * with no need for creating real nodes under taxonomies.
  */
 
-function _customerror_enum_errors() {
-  // This is where the error codes and their default descriptions are
-  // stored. Add here as necessary.
-  $errors = array(
-    404 => t('requested page not found'),
-    403 => t('access denied'),
-  );
-
-  // Sorting array here by keys so they are logically sorted on form
-  ksort($errors);
-
-  return $errors;
-}
-
-function _customerror_fetch_error($error_code) {
-  $errors = _customerror_enum_errors();
-
-  $default_desc = t('unknown error: @error_code', array('@error_code' => $error_code));
-
-  $r = $default_desc;
-
-  foreach ($errors as $code => $desc) {
-    if ($error_code == $code) {
-      $r = $desc;
-    }
-  }
-  return $r;
-}
 
 /**
  * Implements hook_help().
@@ -49,218 +18,18 @@ function customerror_help($path, $arg) {
       $output = t('Enables the creation of custom error pages for 404 and 403 errors.');
       break;
   }
-  return $output;
-}
-
-/**
- * Displays the module settings form.
- */
-function customerror_admin_settings($form, &$form_state) {
-  $form = array(
-    'customerror_form_description' => array(
-      '#type' => 'markup',
-      '#value' => t('Enter the error pages that will be seen by your visitors when they get the respective errors. You can enter any HTML text. You can point the users to the FAQ, inform them that you reorganized the site, ask them to report the error, login or register, ...etc.'),
-    ),
-  );
-
-  $themes = system_rebuild_theme_data();
-  ksort($themes);
-  $theme_options[0] = t('System default');
-  foreach ($themes as $theme) {
-    $theme_options[$theme->name] = $theme->name;
-  }
-
-  $errors = _customerror_enum_errors();
-  foreach ($errors as $code => $desc) {
-    if (variable_get('site_' . $code, '') != 'customerror/' . $code) {
-      drupal_set_message(t('Error reporting is not set for error !error. Please ensure that the default !error page is set to be customerror/!error on the !link.', array('!error' => $code, '!link' => l(t('Site information settings page'), 'admin/config/system/site-information'))), 'error');
-    }
-  }
-
-  foreach ($errors as $code => $desc) {
-    $group = 'customerror_' . $code . '_group';
-    $form[$group] = array(
-      '#type' => 'fieldset',
-      '#title' => t('!code Error Settings', array('!code' => $code)),
-      '#collapsed' => true,
-      '#collapsible' => true,
-    );
-    $form[$group]['customerror_' . $code . '_title'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Title for @code', array('@code' => $code)),
-      '#default_value' => variable_get('customerror_' . $code . '_title', $desc),
-      '#size' => 70,
-      '#maxlength' => 70,
-      '#description' => t('Title of @code error page', array('@code' => $code . ' error page')),
-    );
-    $form[$group]['customerror_' . $code] = array(
-      '#type' => 'textarea',
-      '#title' => t('Description for ') . $code,
-      '#default_value' => variable_get('customerror_' . $code, $desc),
-      '#rows' => 10,
-      '#description' => t('This text will be displayed if a @code (@desc) error occurs.', array('@code' => $code, '@desc' => $desc)),
-    );
-    $form[$group]['customerror_' . $code . '_theme'] = array(
-      '#type' => 'select',
-      '#options' => $theme_options,
-      '#title' => t('Theme'),
-      '#description' => t('Theme to be used on the error page.'),
-      '#default_value' => customerror_get_theme($code),
-    );
-    $form[$group]['customerror_' . $code . '_php'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Allow PHP code to be executed for @code', array('@code' => $code)),
-      '#default_value' => variable_get('customerror_' . $code . '_php', FALSE),
-      '#description' => t('This allows you to include PHP code (enclosed in &lt;?php ?&gt; tags) for the @code (@desc) message. Note that this can be dangerous in some situations. Make sure that you are aware of the implications.', array('@code' => $code, '@desc' => $desc)),
-    );
-  }
 
-  $form['redirects'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Redirects'),
-    '#collapsed' => TRUE,
-    '#collapsible' => TRUE,
-  );
-  $form['redirects']['customerror_redirect'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Redirect list'),
-    '#default_value' => variable_get('customerror_redirect', ''),
-    '#rows' => 10,
-    '#description' => t('These are custom redirect pairs, one per line. Each pair requires a path to match (which is a regular expression) and a destination separated by a space. The keyword <em>&lt;front></em> is allowed as a destination. If you are unfamilar with regular expressions, a simple search string will work, but will match any part of the URl. For example <em>index.html &lt;front></em> will match both <em>http://example.com/index.html &amp; http://example.com/archive/index.html</em>.'),
-  );
-
-  return system_settings_form($form);
-}
-
-/**
- * Implements hook_menu().
- */
-function customerror_menu() {
-  $items = array();
-
-  $items['admin/config/system/customerror'] = array(
-    'title' => 'Custom error',
-    'description' => 'Enables the creation of custom error pages for 404 and 403 errors.',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('customerror_admin_settings'),
-    'access arguments' => array('administer site configuration'),
-    'type' => MENU_NORMAL_ITEM,
-  );
-
-  $items['customerror'] = array(
-    'title' => 'customerror',
-    'access callback' => TRUE,
-    'page callback' => 'customerror_page',
-    'type' => MENU_CALLBACK,
-  );
-
-  return $items;
-}
-
-/**
- * Displays the 403 or 404 error page.
- */
-function customerror_page() {
-  $code = arg(1);
-
-  // set custom theme for error_page if any has been selected, 0 => default
-  $theme = customerror_get_theme($code);
-  if (!empty($theme)) {
-    global $custom_theme;
-    $custom_theme = $theme;
-  }
-
-  switch ($code) {
-    case 403:
-      $internal_path = substr(request_uri(), strlen(base_path()));
-      if ($internal_path) {
-        $dest = drupal_parse_url($internal_path);
-        if (isset($dest['query']['destination'])) {
-          $_GET['destination'] = ($dest['query']['destination']);
-        }
-        else {
-          $_GET['destination'] = $internal_path;
-        }
-      }
-      else {
-        $_GET['destination'] = variable_get('site_frontpage', 'node');
-      }
-      $_SESSION['destination'] = $_GET['destination'];
-    case 404:
-    default: // Treat an unknown method as a 404
-      // Check if we should redirect
-      customerror_check_redirect();
-
-      // Make sure that we sent an appropriate header
-      customerror_header($code);
-
-      module_invoke_all('customerror_pre_render', $code);
-
-      drupal_set_title(variable_get('customerror_' . $code . '_title', _customerror_fetch_error($code)));
-      $output = theme('customerror', array(
-        'code' => $code,
-        'content' => variable_get('customerror_' . $code, _customerror_fetch_error($code)),
-      ));
-      if (module_exists('php')) {
-        $output = (variable_get('customerror_' . $code . '_php', FALSE)) ? php_eval($output) : $output;
-
-      }
-      break;
-  }
   return $output;
 }
 
-/**
- * Sets the http header depending on the error code (403 or 404).
- *
- * @param integer $code
- *   The error code, either 403 or 404.
- */
-function customerror_header($code) {
-  switch ($code) {
-    case 403:
-      drupal_add_http_header('Status', '403 Forbidden');
-      break;
-    case 404:
-      drupal_add_http_header('Status', '404 Not Found');
-      break;
-  }
-}
-
-/**
- * Implements hook_theme().
- */
-function customerror_theme() {
-  return array(
-    'customerror' => array(
-      'variables' => array('code' => NULL, 'content' => NULL),
-    ),
-  );
-}
-
-/**
- * Returns HTML for a customized error message.
- *
- * @param $variables
- *   An associative array containing:
- *   - code: HTTP responce status.
- *   - content: markup message.
- *
- * @ingroup themeable
- */
-function theme_customerror($variables) {
-  $code = $variables['code'];
-  $content = $variables['content'];
-  return $content;
-}
 
 /**
  * Implements hook_user_login().
  */
 function customerror_user_login(&$edit, $account) {
-  // Check if we have a destination saved in the session
+  // Check if we have a destination saved in the session.
   if (!empty($_SESSION['destination'])) {
-    // If there is one, then set the REQUEST destination to it
+    // If there is one, then set the REQUEST destination to it.
     $dest = drupal_parse_url($_SESSION['destination']);
     if (isset($dest['query']['destination'])) {
       $dnode = $dest['query']['destination'];
@@ -269,63 +38,48 @@ function customerror_user_login(&$edit, $account) {
       $dnode = $dest['path'];
     }
     else {
-      $dnode = variable_get('site_frontpage', 'node');
+      $dnode = \Drupal::config('system.site')->get('page.front');
     }
     $_GET['destination'] = $dnode;
-    // And clear the one in the session
+    // And clear the one in the session.
     unset($_SESSION['destination']);
-    // user.module then does a drupal_goto() for us after we return from here
+    // user.module then does a drupal_goto() for us after we return from here.
   }
 }
 
-function customerror_check_redirect() {
-  if (empty($_GET['destination'])) {
-    return;
-  }
-  $destination = $_GET['destination'];
-
-  $redirect_list = variable_get('customerror_redirect', '');
-  if (empty($redirect_list)) {
-    return;
-  }
-  $redirect_list = explode("\n", $redirect_list);
-  foreach ($redirect_list as $item) {
-    list($src, $dst) = explode(' ', $item);
-    if (isset($src) && isset($dst)) {
-      $src = str_replace("/", "\\/", $src);
-      $dst = str_replace("\r", "", $dst);
-      // In case there are spaces in the URL, we escape them
-      $orig_dst = str_replace(" ", "%20", $destination);
-      if (preg_match('/' . $src . '/', $orig_dst)) {
-        $_GET['destination'] = $dst;
-        drupal_goto($dst);
-      }
-    }
-  }
-}
 
 /**
- * Implements hook_form_FORM_ID_alter().
+ * Sets the http header depending on the error code (403 or 404).
  *
- * We need this to be able to search from the error pages, otherwise
- * the form POST's to the error page, bringing no results page.
+ * @param int $code
+ *   The error code, either 403 or 404.
  */
-function customerror_form_search_theme_form_alter(&$form, &$form_state, $form_id) {
-  if (arg(0) == 'customerror') {
-    $form['#action'] = url('search/node');
+function customerror_header($code) {
+  switch ($code) {
+    case 403:
+      drupal_add_http_header('Status', '403 Forbidden');
+      break;
+    case 404:
+      drupal_add_http_header('Status', '404 Not Found');
+      break;
   }
 }
 
+
 /**
  * Gets the configured display theme for the given error code.
+ *
+ * @param int $code
+ *   The code of error.
+ *
+ * @return sting $theme
+ *   The name of theme.
  */
 function customerror_get_theme($code = 404) {
-  $theme = 0;
 
-  $admin_theme = variable_get('admin_theme', 0);
-  if ($admin_theme) {
-    $theme = variable_get('customerror_' . $code . '_theme', $admin_theme);
-  }
+  $theme_default     = \Drupal::config('system.theme')->get('admin');
+  $customerror_theme = \Drupal::config('customerror.config')->get("customerror_{$code}.theme");
+  $theme             = !empty($customerror_theme) ? $customerror_theme : $theme_default;
 
   return $theme;
 }
diff --git a/var/www/drupal8/sites/all/modules/customerror/customerror.routing.yml b/var/www/drupal8/sites/all/modules/customerror/customerror.routing.yml
new file mode 100644
index 0000000..4cbf727
--- /dev/null
+++ b/var/www/drupal8/sites/all/modules/customerror/customerror.routing.yml
@@ -0,0 +1,16 @@
+customerror.module_settings:
+  path: '/admin/config/system/customerror'
+  defaults:
+    _form: 'Drupal\customerror\Form\CustomErrorSettingsForm'
+    _title: 'Custom error'
+  requirements:
+    _permission: 'access administration pages'
+
+customerror.error_page:
+  path: 'customerror/{code}'
+  defaults:
+    _title_callback: '\Drupal\customerror\Controller\CustomErrorController::titleCallback'
+    _content: '\Drupal\customerror\Controller\CustomErrorController::index'
+    code: '404'
+  requirements:
+    _access: 'TRUE'
diff --git a/var/www/drupal8/sites/all/modules/customerror/lib/Drupal/customerror/Controller/CustomErrorController.php b/var/www/drupal8/sites/all/modules/customerror/lib/Drupal/customerror/Controller/CustomErrorController.php
new file mode 100644
index 0000000..86ce63c
--- /dev/null
+++ b/var/www/drupal8/sites/all/modules/customerror/lib/Drupal/customerror/Controller/CustomErrorController.php
@@ -0,0 +1,102 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\customerror\Controller\CustomErrorController.
+ */
+
+
+namespace Drupal\customerror\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+use Symfony\Component\HttpFoundation\RedirectResponse;
+
+
+/**
+ * Controller for errors pages.
+ */
+class CustomErrorController extends ControllerBase {
+
+
+  /**
+   * This is the method that will get called, with the services above already available.
+   *
+   * @param int $code
+   *   The code of error.
+   */
+  public function index($code) {
+
+    $theme = customerror_get_theme($code);
+
+    if (!empty($theme)) {
+      global $custom_theme;
+      $custom_theme = $theme;
+    }
+
+    switch ($code) {
+      case 403:
+        $internal_path = substr(request_uri(), strlen(base_path()));
+        if ($internal_path) {
+          $dest = drupal_parse_url($internal_path);
+          if (isset($dest['query']['destination'])) {
+            $_GET['destination'] = ($dest['query']['destination']);
+          }
+          else {
+            $_GET['destination'] = $internal_path;
+          }
+        }
+        else {
+          $_GET['destination'] = \Drupal::config('system.site')->get('page.front');
+        }
+        $_SESSION['destination'] = $_GET['destination'];
+
+      case 404:
+      default:
+
+        // Check if we should redirect.
+        $destination   = request_uri();
+        $redirect_list = \Drupal::config('customerror.config')->get('customerror_redirect');
+        $redirect_list = !empty($redirect_list) ? explode("\n", $redirect_list) : array();
+        foreach ($redirect_list as $item) {
+          list($src, $dst) = explode(' ', $item);
+
+          if (isset($src) && isset($dst)) {
+            $src = str_replace("/", "\\/", $src);
+            $dst = str_replace("\r", "", $dst);
+
+            // In case there are spaces in the URL, we escape them.
+            $orig_dst = str_replace(" ", "%20", $destination);
+            if (preg_match("/$src/", $orig_dst)) {
+              // drupal_goto($dst);
+              // return new RedirectResponse(url($dst, array('absolute' => TRUE)));
+
+              header('Location: ' . $dst, TRUE, 302);
+              exit();
+            }
+          }
+        }
+
+        // Make sure that we sent an appropriate header.
+        customerror_header($code);
+
+        $content = \Drupal::config('customerror.config')->get("customerror_{$code}.body");
+        break;
+    }
+
+    return $content;
+  }
+
+
+  /**
+   * Route title callback.
+   *
+   * @param int $code
+   *   The code of error.
+   *
+   * @return string
+   *   The title to page.
+   */
+  public function titleCallback($code) {
+    return \Drupal::config('customerror.config')->get("customerror_{$code}.title");
+  }
+}
diff --git a/var/www/drupal8/sites/all/modules/customerror/lib/Drupal/customerror/Form/CustomErrorSettingsForm.php b/var/www/drupal8/sites/all/modules/customerror/lib/Drupal/customerror/Form/CustomErrorSettingsForm.php
new file mode 100644
index 0000000..8bbb4a2
--- /dev/null
+++ b/var/www/drupal8/sites/all/modules/customerror/lib/Drupal/customerror/Form/CustomErrorSettingsForm.php
@@ -0,0 +1,149 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\customerror\Form\CustomErrorSettingsForm.
+ */
+
+
+namespace Drupal\customerror\Form;
+
+use Drupal\Core\Config\ConfigFactory;
+use Drupal\Core\Path\AliasManagerInterface;
+use Drupal\Core\Form\ConfigFormBase;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+
+/**
+ * Provides a form controller for module settings.
+ */
+class CustomErrorSettingsForm extends ConfigFormBase {
+  protected $aliasManager;
+
+
+  /**
+   *
+   */
+  public function __construct(ConfigFactory $config_factory, AliasManagerInterface $alias_manager) {
+    parent::__construct($config_factory);
+    $this->aliasManager = $alias_manager;
+  }
+
+
+  /**
+   * This method lets us inject the services this class needs.
+   *
+   * Only inject services that are actually needed. Which services
+   * are needed will vary by the controller.
+   */
+  public static function create(ContainerInterface $container) {
+    return new static(
+      $container->get('config.factory'),
+      $container->get('path.alias_manager')
+    );
+  }
+
+
+  /**
+   * Implements get function for form ID.
+   */
+  public function getFormId() {
+    return 'custom_error_settings_form';
+  }
+
+
+  /**
+   * Implements callback form for admin page in customerror module.
+   */
+  public function buildForm(array $form, array &$form_state) {
+
+    $form['customerror_form_description'] = array(
+      '#markup' => $this->t('Enter the error pages that will be seen by your visitors when they get the respective errors. You can enter any HTML text. You can point the users to the FAQ, inform them that you reorganized the site, ask them to report the error, login or register, ...etc.'),
+    );
+
+    $themes = system_rebuild_theme_data();
+    ksort($themes);
+    $theme_options[0] = $this->t('System default');
+    foreach ($themes as $theme) {
+      $theme_options[$theme->name] = $theme->name;
+    }
+
+    $errors = array(
+      403 => $this->t('access denied'),
+      404 => $this->t('requested page not found'),
+    );
+    foreach ($errors as $code => $desc) {
+      if (\Drupal::config('system.site')->get("page.$code") != "customerror/{$code}") {
+        drupal_set_message($this->t('Error reporting is not set for error !error. Please ensure that the default !error page is set to be customerror/!error on the !link.', array('!error' => $code, '!link' => l(t('Site information settings page'), 'admin/config/system/site-information'))), 'error', FALSE);
+      }
+    }
+    foreach ($errors as $code => $desc) {
+      $form[$code] = array(
+        '#type'  => 'details',
+        '#title' => $this->t('!code Error Settings', array('!code' => $code)),
+        '#open'  => FALSE,
+      );
+      $form[$code]["customerror_{$code}_title"] = array(
+        '#type'          => 'textfield',
+        '#title'         => $this->t('Title for @code', array('@code' => $code)),
+        '#maxlength'     => 70,
+        '#description'   => $this->t('Title of @code error page', array('@code' => $code)),
+        '#default_value' => \Drupal::config('customerror.config')->get("customerror_{$code}.title"),
+      );
+      $form[$code]["customerror_{$code}_body"] = array(
+        '#type'          => 'textarea',
+        '#title'         => $this->t('Description for !code', array('!code' => $code)),
+        '#rows'          => 10,
+        '#description'   => $this->t('This text will be displayed if a @code (@desc) error occurs.', array('@code' => $code, '@desc' => $desc)),
+        '#default_value' => \Drupal::config('customerror.config')->get("customerror_{$code}.body"),
+      );
+      $form[$code]["customerror_{$code}_theme"] = array(
+        '#type'          => 'select',
+        '#options'       => $theme_options,
+        '#title'         => $this->t('Theme'),
+        '#description'   => $this->t('Theme to be used on the error page.'),
+        '#default_value' => customerror_get_theme($code),
+      );
+    }
+
+    $form['redirects'] = array(
+      '#type'  => 'details',
+      '#title' => $this->t('Redirects'),
+      '#open'  => FALSE,
+    );
+    $form['redirects']['customerror_redirect'] = array(
+      '#type'          => 'textarea',
+      '#title'         => $this->t('Redirect list'),
+      '#rows'          => 10,
+      '#description'   => t('These are custom redirect pairs, one per line. Each pair requires a path to match (which is a regular expression) and a destination separated by a space. The keyword <em>&lt;front></em> is allowed as a destination. If you are unfamilar with regular expressions, a simple search string will work, but will match any part of the URl. For example <em>index.html &lt;front></em> will match both <em>http://example.com/index.html &amp; http://example.com/archive/index.html</em>.'),
+      '#default_value' => \Drupal::config('customerror.config')->get('customerror_redirect'),
+    );
+    $form['submit'] = array(
+      '#type'  => 'submit',
+      '#value' => $this->t('Save'),
+    );
+
+    return $form;
+  }
+
+
+  /**
+   * Implements submit function for the "custom_error_settings_form" form.
+   */
+  public function submitForm(array &$form, array &$form_state) {
+
+    \Drupal::config('customerror.config')
+      ->set('customerror_403', array(
+        'title' => $form_state['values']['customerror_403_title'],
+        'body'  => $form_state['values']['customerror_403_body'],
+        'theme' => $form_state['values']['customerror_403_theme'],
+      ))
+      ->set('customerror_404', array(
+        'title' => $form_state['values']['customerror_404_title'],
+        'body'  => $form_state['values']['customerror_404_body'],
+        'theme' => $form_state['values']['customerror_404_theme'],
+      ))
+      ->set('customerror_redirect', $form_state['values']['customerror_redirect'])
+      ->save();
+  }
+}
