Skip to content
Snippets Groups Projects
Commit bb71340c authored by Josef Glatz's avatar Josef Glatz Committed by Stefan Bürk
Browse files

[DOCS] Add hint about relative targets in redirects

This patch extends the documentation of typo3/cms-redirects by
an example of redirecting to an relative target while using
regular-expressions. This adds more clarity for TYPO3 integrators
and administrators.

Resolves: #99639
Releases: main, 11.5
Change-Id: I6f6e24b5cf0a378d0efe0c7266c9abf249559e7d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77496


Tested-by: default avatarChris Müller <typo3@krue.ml>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarChris Müller <typo3@krue.ml>
parent ff824397
Branches
Tags
No related merge requests found
......@@ -264,23 +264,47 @@ Notes
Regex examples
--------------
Example 1: Source path with regular expression and capturing group.
Example 1: Source path with regular expression and capturing group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
redirect
+-----------------------------------------+-----------------------+----------------------------+
| Source Path | Is Regular Expression | target |
+-----------------------------------------+-----------------------+----------------------------+
| `#^/path/([a-zA-Z]{1}[a-zA-Z0-9_/-]+)#` | true | https://mysite/newpath/$1 |
+-----------------------------------------+-----------------------+----------------------------+
+-------------------------------------------------+-----------------------+----------------------------------------+
| Source Path | Is Regular Expression | target |
+-------------------------------------------------+-----------------------+----------------------------------------+
| `#^/path/([a-zA-Z]{1}[a-zA-Z0-9_/-]+)#` | true | :samp:`https://example.org/newpath/$1` |
+-------------------------------------------------+-----------------------+----------------------------------------+
with the following result:
+-------------------------------+----------------------------------+
| URL | result URL |
+-------------------------------+----------------------------------+
| https://mysite/path/something | https://mysite/newpath/something |
+-------------------------------+----------------------------------+
+--------------------------------------------+-----------------------------------------------+
| URL | result URL |
+--------------------------------------------+-----------------------------------------------+
| :samp:`https://example.org/path/something` | :samp:`https://example.org/newpath/something` |
+--------------------------------------------+-----------------------------------------------+
Example 2: Source path with regular expression, capturing group and relative target
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
redirect
+-------------------------------------------------+-----------------------+---------------+
| Source Path | Is Regular Expression | target |
+-------------------------------------------------+-----------------------+---------------+
| `#^/another/path/([a-zA-Z]{1}[a-zA-Z0-9_/-]+)#` | true | `/newpath/$1` |
+-------------------------------------------------+-----------------------+---------------+
with the following result:
+----------------------------------------------------+--------------------------------------------------------+
| URL | result URL |
+----------------------------------------------------+--------------------------------------------------------+
| :samp:`https://example.org/another/path/something` | :samp:`https://example.org/relative/newpath/something` |
+----------------------------------------------------+--------------------------------------------------------+
Using a relative target is necessary if a redirect must work on multiple domains or multiple environments.
.. important::
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment