Problem/Motivation
The Redirect module seems to be designed to work the following way.
- To redirect from an old URL alias, or a non-existing/external path, administrators can create redirects that using that as the source.
- To redirect from a valid route to another, administrators should use the internal path of the route and NOT its URL alias.
This seems to be because you wouldn't have a reason to redirect an active URL alias, you would want to redirect the route/entity completely instead. If the URL alias for that route/entity were to change, the redirect would be lost/not applicable otherwise.
The Redirect module, therefore, passes the URL through the inbound path processor before looking up for redirects, and that converts it to its internal path. Therefore, redirects that use active URL alias are ignored - they are invalid.
This module, however, displays the opposite behavior. If you create a redirect using the URL alias of an entity as its source then that is picked up, while if you create a redirect using the internal path as its source then that is ignored.
This causes confusion for administrators, and opens up the potential for bugs as it has the opposite behavior of the Redirect module.
Steps to reproduce
- Create a redirect using the URL alias of an entity as its source and observe that it is taken into account in a Drupal frontend.
- Create a redirect using the internal path as its source and observe that it is ignored in a Drupal frontend.
- Create a redirect using the URL alias of an entity as its source and observe that it is taken into account in the Decoupled Router response.
- Create a redirect using the internal path as its source and observe that it is ignored in the Decoupled Router response.
Proposed resolution
Add an event subscriber that processes the path before the other path translators are executed.
Remaining tasks
Agree on the issue and the approach.
API changes
I guess this is a behavioral change that may affect some applications. Administrators on existing sites may have been creating redirects the wrong way as a result of that behavior and making the propose change - while correcting the behavior - might cause unexpected results on existing applications in such cases.