[!!!][TASK] Remove deprecated code from TableController
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Documentation / Changelog / 9.5 / Feature-86214-ImplementStaticRoutes.rst
1 .. include:: ../../Includes.txt
2 .. highlight:: yaml
3
4 =========================================
5 Feature: #86214 - Implement static routes
6 =========================================
7
8 See :issue:`86214`
9
10 Description
11 ===========
12
13 The site configuration module now has configuration options to add static routes on a per site basis.
14 Take the following example: In a multi-site installation you want to have different robots.txt files for each site that
15 should be reachable at /robots.txt on each site. You can now add a static route "robots.txt" to your site and
16 define which content should be delivered.
17
18 The TYPO3 SEO extension provides a sitemap for TYPO3 out of the box, but it's only reachable at a specific page type.
19 To enable easier access you can now configure a static route :file:`sitemap.xml` that maps to that page type (see example
20 below).
21
22 Routes can be configured as toplevel files (as in the :file:`sitemap.xml` and :file:`robots.txt` case) but may also be configured
23 to deeper route paths (`my/deep/path/to/a/static/text` for example). Matching is done on the full path but without any
24 parameters.
25
26 Impact
27 ======
28
29 Static routes can be configured via the user interface or directly in the yaml configuration.
30 There are two options: deliver static text or resolve a TYPO3 URL.
31
32 StaticText
33 ----------
34
35 The :yaml:`staticText` option allows to deliver simple text content. The text can be added through a text field directly in
36 the site configuration. This is suitable for files like :file:`robots.txt` or :file:`humans.txt`.
37
38 YAML Configuration Example::
39
40 route: robots.txt
41 type: staticText
42 content: |
43 Sitemap: https://example.com/sitemap.xml
44 User-agent: *
45 Allow: /
46 Disallow: /forbidden/
47
48 TYPO3 URL (t3://)
49 -----------------
50
51 The type :yaml:`uri` for TYPO3 URL provides the option to render either a file, page or url. Internally a request to the
52 file or URL is done and its content delivered.
53
54 YAML Configuration Examples::
55
56 -
57 route: sitemap.xml
58 type: uri
59 source: 't3://page?uid=1&type=1533906435'
60 -
61 route: favicon.ico
62 type: uri
63 source: 't3://file?uid=77'
64
65
66 Implementation
67 ==============
68
69 Static route resolving is implemented as a PSR-15 middleware. If the route path requested matches any one of the
70 configured site routes, a response is directly generated and returned. This way there is minimal bootstrap code to
71 be executed on a static route resolving request, mainly the site configuration needs to be loaded. Static routes cannot
72 get parameters as the matching is done solely on the path level.
73
74
75 .. index:: Frontend, ext:frontend