Issue Bug Closed

#101191Redirects with regexp endabled and same urls, but one with additional query params matching the wrong one first

Marc Bastian Heinrichs 06/28/23, 20:49 updated 07/09/24, 14:15

Description

Example:
Need to match on two urls, each with different variants, that’s why regexp is enabled, but one differs only by the query params from the other:

  1. /foo/(different_part)bar.html
  2. /foo/(different_part)bar.html?type=101

Created two regexp redirects records in this order (important):

  1. /\/foo\/(.*)bar.html$/ with target A
  2. /\/foo\/(.*)bar.html\?type=101/ with target B

With url 2 record 1 matches first, which is wrong. Record 2 should match first
If the redirect records are created the other way round it works correct, but this is not the solution.

IMO the foreach for the regexp redirects in RedirectService::matchRedirect needs to be run though twice, first with query and second one without, instead of a single run.

Reviews 3