--- label: 'Configuring error responses, including 403/404 pages' related: - system.config_basic - core.maintenance --- {% set log_settings_url = render_var(url('system.logging_settings')) %} {% set information_url = render_var(url('system.site_information_settings')) %}

{% trans %}Goal{% endtrans %}

{% trans %}Set up your site to respond appropriately to site errors, including 403 and 404 page responses.{% endtrans %}

{% trans %}What are 403 and 404 responses?{% endtrans %}

{% trans %}When a user visits a web page, the web server sends a response code in addition to the page content. A normal, non-error response has code 200. If the page does not exist on the site, the response code is 404. If the page exists, but the user is not authorized to visit the page, the response code is 403. The core software provides default responses for both 403 and 404 codes, but if you prefer, you can create your own pages for each.{% endtrans %}

{% trans %}What other errors can occur?{% endtrans %}

{% trans %}Under some situations, your site can generate error messages. These can be due to user errors (such as entering invalid values in a form, or incorrect configuration), PHP runtime errors, or software bugs. Some errors may result in a white screen of death (a totally blank web page response); less drastic errors will generate error messages. You can configure what happens when an error message is generated.{% endtrans %}

{% trans %}Steps {% endtrans %}

  1. {% trans %}If desired, create pages to use for 403 and 404 responses. Note the URLs for these pages.{% endtrans %}
  2. {% trans %}In the Manage administrative menu, navigate to Configuration > System > Basic site settings.{% endtrans %}
  3. {% trans %}In the Error pages section, enter the URL for your 403/403 pages, starting after the site home page URL. For example, if your site URL is https://example.com and your 404 page is https://example.com/not-found, you would enter /not-found.{% endtrans %}
  4. {% trans %}Click Save configuration. You should see a message indicating that the settings were saved.{% endtrans %}
  5. {% trans %}In the Manage administrative menu, navigate to Configuration > Development > Logging and errors.{% endtrans %}
  6. {% trans %}For a production site, select None under Error messages to display. For a site that is in development, select one of the other options, so that you are more aware of the errors the site is generating.{% endtrans %}
  7. {% trans %}Click Save configuration. You should see a message indicating that the settings were saved.{% endtrans %}