The TYPO3 Redirects module: Technical documentation with source code

New tool in the backend since TYPO3 9: Redirects

Since TYPO3 v9 there is a new standard module in the backend under the new item page management: Redirects. There is currently little or no technical documentation available, although this tool has many advantages in everyday work. Above all, it allows backend users (e.g. editors, SEO managers, content managers) to easily create URL redirects.

Necessity of a redirect module

In the past, redirects have been inserted directly into the source code, or a custom implementation has been used. This is particularly problematic when a server change takes place (e.g. from Apache to nginx), since the syntax has to be adapted according to the server. Before TYPO3 offered redirects, it was the developer's task to set up URL redirects. With the new module, editors of a TYPO3 website can do this themselves.

Function and advantages of the redirect module

The Redirects module works with fields like source and target URL as well as other features like GET parameters and the HTTP header status.

  1. First the source domain is entered. If there are several domains, a drop-down can be used to make the appropriate assignment.
  2. a. If there is a path to the domain that should be redirected, this is entered in the next field (Source Path).
    b. If an entire page and its sub-pages are to be redirected to a new domain, the code /.*/ (slash-dot-star-slash) must be entered in this field. The forwarding takes effect for all pages and subpages of the website.
    IMPORTANT: The names of the paths (e.g. in the navigation: homepage, about us, imprint, etc.) in the target URL must be identical to the source URL.
    c. Paths with placeholders only work when Is regular expression? is enabled.
  3. Respect GET Parameters means that the parameters after the URL are also taken into account (e.g. for forms).
  4. Target defines the destination URL.
  5. The Status Code HTTP Header describes if the forwarding should be temporary or permanent. For temporary forwardings, the old domain is still indexed.
  6. If the site has an SSL certificate (HTTPS), the option Force SSL Redirect supports this. Otherwise it can remain deactivated.
  7. To retain the parameters after the source URL in the target URL, select Keep GET Parameters.

Although the syntax needs to be cleaned up to get the module to work when switching from version 8 (or lower) to 9, there are several advantages:

  Saves time: No code needed for redirects
  Easy to use: No developer needed
  Webserver-independent: Configuration of the webserver stays clean
  Clear overview: Central location for redirect configuration
  Automatic redirections: When renaming a page, the old path is automatically redirected to the new one
  Webserver performance not important: Smart caching mechanism executes redirects before initializing TYPO3

Source code examples

NGINX & Apache

Redirects after configuration in TYPO3

The redirects module is just right for your website? Then switch to TYPO3 v10 with us now and benefit from this new standard feature!

Share article:
Related topics