Bug #89799
closedCapture groups for regex redirects are not respected in target
100%
Description
Steps to reproduce:
- Create a redirect
- source: for example
#^/foo/(.*)#
- target:
http://another.domain/$1
- go to
your.domain/foo/bar
- Redirect is triggered but literally to to
http://another.domain/$1
Expected result: Redirect is made to http://another.domain/bar
Parsing the capture groups is not simply defect but actually not implemented at all. I flagged this explicitly as a bug (not as a feature) however, because the documentation does not clearly state this limitation and the module and GUI clearly allow regex-enabled redirects, so everything is suggesting that this must work and the backend editors and developers are left alone wasting their time to find out the hard way that this is not working - which is clearly a bug then.
Updated by S P almost 5 years ago
Forget a step to reproduce: enable the regex toggle in the redirect, obviously.
Updated by Riccardo De Contardi almost 5 years ago
- Category set to Site Handling, Site Sets & Routing
Updated by Bastian Stargazer almost 5 years ago
Ah thats why! This behaviour drove me crazy few month back! I thought I was just to dumb to use the regexp here because it was not working at all.
Good to know that it is a bug. I hope it will work sometimes in the future, thanks for pointing that out.
Updated by Gerrit Code Review almost 5 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62781
Updated by Gerrit Code Review almost 5 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62781
Updated by Gerrit Code Review almost 5 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62781
Updated by Gerrit Code Review almost 5 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62781
Updated by Gerrit Code Review almost 5 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62884
Updated by Guido Schmechel almost 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 5f6f2abed4e5295f45bf19b7240353f35eb54a0f.
Updated by Gerrit Code Review almost 5 years ago
- Status changed from Resolved to Under Review
Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62884
Updated by Guido Schmechel almost 5 years ago
- Status changed from Under Review to Resolved
Applied in changeset dc8276577bb37dc48a0df4c9ebf2ec6fe90e96ba.
Updated by Armin Vieweg over 4 years ago
- Precedes Bug #91796: Capture groups for regex redirects are not respected in target, when target starts with path added
Updated by Gerrit Hübbers about 4 years ago
Does not work for me on 9.5.22 when the source_path
does not include the dollar sign.
- Doesn't work:
#^/foo(.*)#
- Works:
#^/foo(.*)$#
Tested with target
https://www.example.com/angebot$1
Updated by Benjamin Eyring over 3 years ago
Hi all,
in file
typo3_src-10.4.18/typo3/sysext/redirects/Classes/Service/RedirectService.php
in line 217 one can see that the ceptureGroup Replacement is realised only for redirects to files, folders, external URLs. Not pages.
What is the reason for that decision?
Thx in advance and best regards,
Ben
Updated by Mathias Brodala about 3 years ago
Updated by Stefan Bürk about 3 years ago
Benjamin Eyring wrote in #note-15:
Hi all,
in file
typo3_src-10.4.18/typo3/sysext/redirects/Classes/Service/RedirectService.phpin line 217 one can see that the ceptureGroup Replacement is realised only for redirects to files, folders, external URLs. Not pages.
What is the reason for that decision?
Thx in advance and best regards,
Ben
That's not a question of a decision. The provided target is run through the LinkHandler stack to resolve the target. This returns different types of resolved targets.
Running any kind of capture group replacement does not make sense on resolved page type, as the returned url of a pages cannot have a capture group definition in it.
That was what I would say first. Thinking about it, it could be a shortcut page with an redirect, which holds an capture group. Which is another point. Was that your usecase
why you asked why it was not done for pages ?