Skip to content
TYPO3: Display custom 403/404/500 pages.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Classes/Utility
Libraries
Resources
.gitignore
.php_cs.dist
README.md
composer.json
ext_conf_template.txt
ext_emconf.php
ext_localconf.php

README.md

This version of the custom_error_page can only be used by >= TYPO3 8 LTS instances.

How to use

There are up to three steps to take:

  • Set up the YAML with all your domains for each page root tree and their pids to their specific 403/404/503 page. An example file is in the folder "Examples" of this extension. The default file destination is "typo3conf/custom_error_conf.yml".

  • Change the value of [FE][pageNotFound_handling] to "USER_FUNCTION:Bitmotion\CustomErrorPage\Utility\CustomErrorPageUtility->showCustom404Page" (without "")

  • Change the value of [FE][pageUnavailable_handling] to "USER_FUNCTION:Bitmotion\CustomErrorPage\Utility\CustomErrorPageUtility->showCustom503Page" (without "")

There is a configuration example in Resources/Private/Examples.

Extension Configuration

There are to configuration options.

  • basic.path (string): Path to the YAML file containing the configuration (see: below).
  • basic.force404 (bool): If set, the configured 404 page will shown on 403 errors.

Configuration File

Full example:

configuration: &default
  name: www.domain.tld
  pages:
    403:  89
    404:  12
    503:  29
  language-pattern:
    default: true
    en: 0
    de: 1
    fr: 2
  additional-tlds:
    - tld: .foo
    - tld: .bar
    - tld: .foo.bar
  https: true
  forward-reason: true


404: &404
  - domain:
      <<: *default

403: &403
  <<: *404

503: &503
  <<: *404

403 / 404 / 503

Contains the configuration array for handling 403, 404 or 503 errors. All keys contain an array of domains which does have the following configuration possibilities:

  • name (string): The full name of the domain
  • https (bool): True if SSL is used
  • pages (array): Contains configuration for pages
  • additional-tlds (array): Contains further TLD for configured domain
  • language-pattern (array): Contains configuration for different languages
  • forward-reason (bool): True if the reason must be forwarded to the error page

pages

The pages array does have to options:

  • 403 (int): The ID of the page which should be shown when an 403 error occurs
  • 404 (int): The ID of the page which should be shown when an 404 error occurs
  • 503 (int): The ID of the page which should be shown when an 503 error occurs

additional-tlds

This array contains configuration for further top-level-domains. Each domain will be prepended to the configured name. In our examples this would be www.domain.tld.foo, www.domain.tld.bar and www.domain.tld.foo.bar.

  • tld (string): Additional domain suffix

Also possible:

configuration: &default
  name: www.domain
  [...]
  additional-tlds:
    - tld: .com
    - tld: .de
    - tld: .fr

language-pattern

Additional configuration for multi language sites. This array contains an mapping of the ISO-code and the corresponding sys_language_uid.

In our example we do have three languages configured: en, de and fr. The domain should be available under www.domain.tld/en/, www.domain.tld/de/ and www.domain.tld/fr/.

If there is a sys_language_uid which is not configured in one of the given patterns (for example 'es'), you will get an exception. Prevent that by using the default key and set the value to true.

  • ISO-Code (int): Generic key and value (see above)
  • default (bool): see above
You can’t perform that action at this time.