Bug #89799

Capture groups for regex redirects are not respected in target

Added by Stefan P almost 2 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-11-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce:

  1. Create a redirect
  2. source: for example #^/foo/(.*)#
  3. target: http://another.domain/$1
  4. go to your.domain/foo/bar
  5. 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.


Related issues

Precedes TYPO3 Core - Bug #91796: Capture groups for regex redirects are not respected in target, when target starts with pathNew2019-12-022019-12-02

Actions
#1

Updated by Stefan P almost 2 years ago

Forget a step to reproduce: enable the regex toggle in the redirect, obviously.

#2

Updated by Riccardo De Contardi almost 2 years ago

  • Category set to Link Handling, Site Handling & Routing
#3

Updated by Bastian Stargazer almost 2 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.

#4

Updated by Gerrit Code Review almost 2 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

#5

Updated by Gerrit Code Review almost 2 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

#6

Updated by Gerrit Code Review almost 2 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

#7

Updated by Gerrit Code Review almost 2 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

#8

Updated by Gerrit Code Review almost 2 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

#9

Updated by Guido Schmechel almost 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#10

Updated by Gerrit Code Review almost 2 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

#11

Updated by Guido Schmechel almost 2 years ago

  • Status changed from Under Review to Resolved
#12

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
#13

Updated by Armin Vieweg over 1 year ago

  • Precedes Bug #91796: Capture groups for regex redirects are not respected in target, when target starts with path added
#14

Updated by Gerrit Hübbers 11 months 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

#15

Updated by Benjamin Eyring 3 months 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

Also available in: Atom PDF