You are here

README.txt in Customerror 8

Same filename and directory in other branches
  1. 5 README.txt
  2. 6 README.txt
  3. 7 README.txt
CUSTOM ERROR README.txt
=======================

This module allows the site admin to create custom error pages for
HTTP status codes 403 (access denied) and 404 (not found), without the
need to create nodes for each of them.

Main features:

* Configurable page title and descriptions.
* There are no author and date/time headers as with normal nodes.
* Any HTML formatted text can be be put in the page body.
* The error pages are themeable.
* Users who are not logged in and try to access an area that requires
  login will be redirected to the page they were trying to access after
  they login.
* Allows custom redirects for 404s.

Since the error pages are not real nodes, they do not have a specific
content type, and will not show up in node listings.

At present, the module can be set up to handle 403 and 404
errors. Drupal only allows those two errors to be assigned custom
pages. However, the design of the module is flexible and can
accommodate future error codes easily.


Installation:
-------------

1. Install the customerror module directory in the directory where you
   keep contributed modules (e.g. modules/contrib).

2. Go to the Modules page
   - Enable the Custom Error module.
   Click on Save configuration.

3. Configure Error reporting
   - Go to Configuration -> System -> Site information
   - For 403 (access denied), enter the value:
       customerror/403
   - For 404 (not found), enter the value:
       customerror/404
   Click on Save configuration.

4. Configure the module:
   - Go to Configuration -> System -> Custom error
   - Enter any title and description you want for the 404 (not found)
     and 403 (access denied) pages.
   - You can use any HTML tags to format the text.
   Click on Save configuration.

5. Test your error pages.
   - Copy your present admin page url.
   - Try to go to a non-existent Drupal page on your site.
   You should see your custom error page for 404 (not found) page.

   - Log out from your site.
   - Paste the admin page url and try to go there.
   You should see your custom error page for 403 (access denied) page.



Note that customerror keeps track of what page the user is trying to
access, so after logging in, the user will be redirected to that page.


Custom redirects for 404 errors
-------------------------------

It is possible to set up custom redirects for status code 404 (not
found).

For example if you had a page called foo and a page called xyz, then
you moved them to a page called bar, and abc respectively, you can
setup a redirect pair of:

  ^foo$ bar
  ^xyz$ abc

The first pair will transparently redirect users trying to access
example.com/foo to example.com/bar.  The second pair will
transparently redirect users trying to access example.com/xyz to
example.com/abc.

You can have multiple pairs of redirects. Each must be on a line by
itself.

Note that the first argument is a regexp, and the second argument is a
path. You have to use one space between them, and enter each pattern
on a line by itself. You cannot use variables.

For more flexible URL rewriting, including variables, you may consider
using an external URL rewrite engine, such as Apache mod_rewrite.


FAQ
---

* I want to prevent robots from indexing my custom error pages by
  setting the robots meta tag in the HTML head to NOINDEX.

  - There is no need to. CustomError returns the correct HTTP status
    codes (403 and 404). This will prevent robots from indexing the
    error pages.

* I want to customize the custom error template output.

  - In your site's theme's template folder, duplicate customerror
    module's provided template, at templates/customerror.html.twig to
    be customerror.html.twig and then make your modifications there.

* I want to have a different template for my 404 and 403 pages.

  - Duplicate customerror.html.twig to be customerror--404.html.twig
    and customerror--403.html.twig. You do not need a
    customerror.html.twig for this to work.

* Some 403 errors (e.g. "http://example.org/includes") are served by
  the Apache web server and not by CustomError. Isn't that a bug?

  - No. CustomError is only designed to provide a custom error page
    when the page is processed by Drupal.  The .htaccess file that
    comes with Drupal will catch some attempts to access forbidden
    directories before Drupal even see the requests.  These access
    attempts will get the default Apache 403 error document, unless
    you use the Apache ErrorDocument directive to override this, e.g:
      ErrorDocument 403 /error/403.html
    For more information about this, see:
    http://httpd.apache.org/docs/current/custom-error.html


Database
--------

This module does not require any new database tables to be installed.


Bugs/Features/Patches
---------------------

If you want to report a bug, request a feature, or submit a patch,
please do so in the issue queue at the project page on the Drupal web
site:

   http://drupal.org/project/customerror


Online documentation
--------------------

For more documentation, please see:

   https://drupal.org/node/2064843

Author
------

Principal author is Khalid Baheyeldin
(http://baheyeldin.com/khalid and http://2bits.com).

Port to Drupal 7 port has been overseen by Gisle Hannemyr
(https://drupal.org/user/409554).

The authors can be contacted for paid customizations of this module
as well as Drupal consulting, installation, development, and
customizations.

File

README.txt
View source
  1. CUSTOM ERROR README.txt
  2. =======================
  3. This module allows the site admin to create custom error pages for
  4. HTTP status codes 403 (access denied) and 404 (not found), without the
  5. need to create nodes for each of them.
  6. Main features:
  7. * Configurable page title and descriptions.
  8. * There are no author and date/time headers as with normal nodes.
  9. * Any HTML formatted text can be be put in the page body.
  10. * The error pages are themeable.
  11. * Users who are not logged in and try to access an area that requires
  12. login will be redirected to the page they were trying to access after
  13. they login.
  14. * Allows custom redirects for 404s.
  15. Since the error pages are not real nodes, they do not have a specific
  16. content type, and will not show up in node listings.
  17. At present, the module can be set up to handle 403 and 404
  18. errors. Drupal only allows those two errors to be assigned custom
  19. pages. However, the design of the module is flexible and can
  20. accommodate future error codes easily.
  21. Installation:
  22. -------------
  23. 1. Install the customerror module directory in the directory where you
  24. keep contributed modules (e.g. modules/contrib).
  25. 2. Go to the Modules page
  26. - Enable the Custom Error module.
  27. Click on Save configuration.
  28. 3. Configure Error reporting
  29. - Go to Configuration -> System -> Site information
  30. - For 403 (access denied), enter the value:
  31. customerror/403
  32. - For 404 (not found), enter the value:
  33. customerror/404
  34. Click on Save configuration.
  35. 4. Configure the module:
  36. - Go to Configuration -> System -> Custom error
  37. - Enter any title and description you want for the 404 (not found)
  38. and 403 (access denied) pages.
  39. - You can use any HTML tags to format the text.
  40. Click on Save configuration.
  41. 5. Test your error pages.
  42. - Copy your present admin page url.
  43. - Try to go to a non-existent Drupal page on your site.
  44. You should see your custom error page for 404 (not found) page.
  45. - Log out from your site.
  46. - Paste the admin page url and try to go there.
  47. You should see your custom error page for 403 (access denied) page.
  48. Note that customerror keeps track of what page the user is trying to
  49. access, so after logging in, the user will be redirected to that page.
  50. Custom redirects for 404 errors
  51. -------------------------------
  52. It is possible to set up custom redirects for status code 404 (not
  53. found).
  54. For example if you had a page called foo and a page called xyz, then
  55. you moved them to a page called bar, and abc respectively, you can
  56. setup a redirect pair of:
  57. ^foo$ bar
  58. ^xyz$ abc
  59. The first pair will transparently redirect users trying to access
  60. example.com/foo to example.com/bar. The second pair will
  61. transparently redirect users trying to access example.com/xyz to
  62. example.com/abc.
  63. You can have multiple pairs of redirects. Each must be on a line by
  64. itself.
  65. Note that the first argument is a regexp, and the second argument is a
  66. path. You have to use one space between them, and enter each pattern
  67. on a line by itself. You cannot use variables.
  68. For more flexible URL rewriting, including variables, you may consider
  69. using an external URL rewrite engine, such as Apache mod_rewrite.
  70. FAQ
  71. ---
  72. * I want to prevent robots from indexing my custom error pages by
  73. setting the robots meta tag in the HTML head to NOINDEX.
  74. - There is no need to. CustomError returns the correct HTTP status
  75. codes (403 and 404). This will prevent robots from indexing the
  76. error pages.
  77. * I want to customize the custom error template output.
  78. - In your site's theme's template folder, duplicate customerror
  79. module's provided template, at templates/customerror.html.twig to
  80. be customerror.html.twig and then make your modifications there.
  81. * I want to have a different template for my 404 and 403 pages.
  82. - Duplicate customerror.html.twig to be customerror--404.html.twig
  83. and customerror--403.html.twig. You do not need a
  84. customerror.html.twig for this to work.
  85. * Some 403 errors (e.g. "http://example.org/includes") are served by
  86. the Apache web server and not by CustomError. Isn't that a bug?
  87. - No. CustomError is only designed to provide a custom error page
  88. when the page is processed by Drupal. The .htaccess file that
  89. comes with Drupal will catch some attempts to access forbidden
  90. directories before Drupal even see the requests. These access
  91. attempts will get the default Apache 403 error document, unless
  92. you use the Apache ErrorDocument directive to override this, e.g:
  93. ErrorDocument 403 /error/403.html
  94. For more information about this, see:
  95. http://httpd.apache.org/docs/current/custom-error.html
  96. Database
  97. --------
  98. This module does not require any new database tables to be installed.
  99. Bugs/Features/Patches
  100. ---------------------
  101. If you want to report a bug, request a feature, or submit a patch,
  102. please do so in the issue queue at the project page on the Drupal web
  103. site:
  104. http://drupal.org/project/customerror
  105. Online documentation
  106. --------------------
  107. For more documentation, please see:
  108. https://drupal.org/node/2064843
  109. Author
  110. ------
  111. Principal author is Khalid Baheyeldin
  112. (http://baheyeldin.com/khalid and http://2bits.com).
  113. Port to Drupal 7 port has been overseen by Gisle Hannemyr
  114. (https://drupal.org/user/409554).
  115. The authors can be contacted for paid customizations of this module
  116. as well as Drupal consulting, installation, development, and
  117. customizations.