Project

General

Profile

Actions

Bug #101739

closed

Redirects module: regexp enabled, respect get param ignored

Added by Ralf Hübner about 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Link Handling & Redirect Handling
Target version:
-
Start date:
2023-08-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
redirect regexp regex query param
Complexity:
Is Regression:
Sprint Focus:

Description

I need a redirect if no query parameters are present:

/^\/foobar$/ with regexp enabled and "Respect GET Parameters" enabled

should only redirect to target if /foobar is present, but not /foobar?param=data

Do I misunderstood the redirect handling / wrong regexp in this case or is this a bug?

Actions #1

Updated by Stefan Bürk about 1 year ago

  • Assignee set to Stefan Bürk
Actions #2

Updated by Stefan Bürk about 1 year ago

For RegEXP redirects the option "Respect GET Parameters" defines,
if the request uri is matched with the get parameters or without
against the defined RegEXP pattern.

REQUEST: https://domain.tld/foobar?param1&value=1
PATTERN: /^\/foobar$/

With "Respect GET Parameters" enabled the request path with query parameters
is matched against the defined pattern, and therefor do not match.

With "Respect GET PArameters" disabled only the path is used to match against
the RegExp pattern and would match ignoring GET parameters completly.

That means, you have to provide a regexp pattern matching also query parameters
if you want to match on specific query parameters only.

So to say, if I understand your description correctly I would say your assumption
is correct.

I could not reproduce this failing and I also created a patch adding tests to
cover exactly these cases to show that it's working.

If you are still getting redirects, you should check the redirect headers - they
should contain a 'X-Redirect-By' header entry with a value like 'TYPO3 Redirect 123',
where the integer value is the uid of the ext:redirects redirect record.

If you had originally other settings, maybe clear the TYPO3 caches AND the browser
caches (as 301 redirects may be cached by the browser for a while). Better check with
curl or something like that.

If you grap the redirect uid from the header you can see if the redirect you have in
mind is really the one doing the redirect or if it is another rule.

Question:

Can it be, that you have a redirect (regexp, plain) that handles /foobar but with
Respect GET Parameters disabled ?

Actions #3

Updated by Stefan Bürk about 1 year ago

And in the case of the example, have you tried to use non-regexp redirects ?

Actions #4

Updated by Gerrit Code Review about 1 year ago

  • Status changed from New to Under Review

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80870

Actions #5

Updated by Gerrit Code Review about 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80870

Actions #6

Updated by Gerrit Code Review about 1 year ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80870

Actions #7

Updated by Gerrit Code Review about 1 year ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80870

Actions #8

Updated by Gerrit Code Review about 1 year ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80870

Actions #9

Updated by Gerrit Code Review about 1 year ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80848

Actions #10

Updated by Gerrit Code Review about 1 year ago

Patch set 1 for branch 11.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/+/80886

Actions #11

Updated by Stefan Bürk about 1 year ago

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

Updated by Benni Mack 4 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF