All languages redirect loaded before language-specific one.

Created on 6 February 2023, almost 2 years ago
Updated 5 May 2023, over 1 year ago

Problem/Motivation

I have multilingual site. If I want to set redirect to different pages for different languages then I always get und redirect if available.

Steps to reproduce

Create 2 languages. For example, en-GB and es-ES.
Create redirects from test/1 to
- node/1 for en-GB
- node/2 for all languages

Expected behavior:
en-GB/test/1 redirected to en-GB/node/1
es-ES/test/1 redirected to es-ES/node/2

Actual behaviour:
en-GB/test/1 redirected to en-GB/node/2
es-ES/test/1 redirected to es-ES/node/2

As I see findMatchingRedirect query always returns und redirect.

I've tried to edit existing redirects and set first one as All languages, second one - language specific. Anyway und returned

Proposed resolution

Replace sorting criteria from ORDER BY LENGTH(redirect_source__query) DESC to ORDER BY FIELD(hash, :hashes[]) ASC because hash array filled by relevance

Patch is attached. Please review it

🐛 Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

🇷🇺Russia vladimir.krupin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024