system.config_error.html.twig

Same filename in other branches
  1. 9 core/modules/help_topics/help_topics/system.config_error.html.twig
  2. 8.9.x core/modules/help_topics/help_topics/system.config_error.html.twig
  3. 10 core/modules/system/help_topics/system.config_error.html.twig
---
label: 'Configuring error responses, including 403/404 pages'
related:
  - system.config_basic
  - core.maintenance
---
{% set log_settings_link_text %}{% trans %}Logging and errors{% endtrans %}{% endset %}
{% set log_settings_link = render_var(help_route_link(log_settings_link_text, 'system.logging_settings')) %}
{% set information_link_text %}{% trans %}Basic site settings{% endtrans %}{% endset %}
{% set information_link = render_var(help_route_link(information_link_text, 'system.site_information_settings')) %}
<h2>{% trans %}Goal{% endtrans %}</h2>
<p>{% trans %}Set up your site to respond appropriately to site errors, including 403 and 404 page responses.{% endtrans %}</p>
<h2>{% trans %}What are 403 and 404 responses?{% endtrans %}</h2>
<p>{% 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 %}</p>
<h2>{% trans %}What other errors can occur?{% endtrans %}</h2>
<p>{% 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 <em>white screen of death</em> (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 %}</p>
<h2>{% trans %}Steps {% endtrans %}</h2>
<ol>
  <li>{% trans %}If desired, create pages to use for 403 and 404 responses. Note the URLs for these pages.{% endtrans %}</li>
  <li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Configuration</em> &gt; <em>System</em> &gt; <em>{{ information_link }}</em>.{% endtrans %}</li>
  <li>{% trans %}In the <em>Error pages</em> section, enter the URL for your 403/404 pages, starting after the site home page URL. For example, if your site URL is <em>https://example.com</em> and your 404 page is <em>https://example.com/not-found</em>, you would enter <em>/not-found</em>.{% endtrans %}</li>
  <li>{% trans %}Click <em>Save configuration</em>. You should see a message indicating that the settings were saved.{% endtrans %}</li>
  <li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Configuration</em> &gt; <em>Development</em> &gt; <em>{{ log_settings_link }}</em>.{% endtrans %}</li>
  <li>{% trans %}For a production site, select <em>None</em> under <em>Error messages to display</em>. 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 %}</li>
  <li>{% trans %}Click <em>Save configuration</em>. You should see a message indicating that the settings were saved.{% endtrans %}</li>
</ol>

File

core/modules/system/help_topics/system.config_error.html.twig

View source
  1. ---
  2. label: 'Configuring error responses, including 403/404 pages'
  3. related:
  4. - system.config_basic
  5. - core.maintenance
  6. ---
  7. {% set log_settings_link_text %}{% trans %}Logging and errors{% endtrans %}{% endset %}
  8. {% set log_settings_link = render_var(help_route_link(log_settings_link_text, 'system.logging_settings')) %}
  9. {% set information_link_text %}{% trans %}Basic site settings{% endtrans %}{% endset %}
  10. {% set information_link = render_var(help_route_link(information_link_text, 'system.site_information_settings')) %}
  11. <h2>{% trans %}Goal{% endtrans %}</h2>
  12. <p>{% trans %}Set up your site to respond appropriately to site errors, including 403 and 404 page responses.{% endtrans %}</p>
  13. <h2>{% trans %}What are 403 and 404 responses?{% endtrans %}</h2>
  14. <p>{% 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 %}</p>
  15. <h2>{% trans %}What other errors can occur?{% endtrans %}</h2>
  16. <p>{% 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 <em>white screen of death</em> (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 %}</p>
  17. <h2>{% trans %}Steps {% endtrans %}</h2>
  18. <ol>
  19. <li>{% trans %}If desired, create pages to use for 403 and 404 responses. Note the URLs for these pages.{% endtrans %}</li>
  20. <li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Configuration</em> &gt; <em>System</em> &gt; <em>{{ information_link }}</em>.{% endtrans %}</li>
  21. <li>{% trans %}In the <em>Error pages</em> section, enter the URL for your 403/404 pages, starting after the site home page URL. For example, if your site URL is <em>https://example.com</em> and your 404 page is <em>https://example.com/not-found</em>, you would enter <em>/not-found</em>.{% endtrans %}</li>
  22. <li>{% trans %}Click <em>Save configuration</em>. You should see a message indicating that the settings were saved.{% endtrans %}</li>
  23. <li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Configuration</em> &gt; <em>Development</em> &gt; <em>{{ log_settings_link }}</em>.{% endtrans %}</li>
  24. <li>{% trans %}For a production site, select <em>None</em> under <em>Error messages to display</em>. 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 %}</li>
  25. <li>{% trans %}Click <em>Save configuration</em>. You should see a message indicating that the settings were saved.{% endtrans %}</li>
  26. </ol>

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.