Redirects are not tied to site configuation breaking referential integrity and making it impossible to test on/transfer from staging systems
The select box for the source domain in the redirects module is filled by using the site configurations and the matching baseVariant. The base variant is shown then.
When saving the redirect it is persisted using the actually shown domain, however (so a
baseVariant gets persited, for example). Not - contrary to what one would expect - the site id or the
base (from where baseVariants could be retrieved as well) to have proper referential integrity.
Why is this relevant? Because with this you can not test redirects on base variant systems. Nor can you have staging system for testing from where you transfer rows of
sys_redirect to the live system.
Currently I'm sitting in front 1000+ redirects having a wrong source_host because a baseVariant was persisted instead of the site id or actual base.... It's also not possible this way to write a SQL update that transforms the source_host to the one relevant for the current system, because you can not join on yaml files obviously.
It must be possible to save redirects in a form that data integrity to the site configurations is preserved. If this is technically not possible there should not be a dropdown letting you select from site configurations implicitly suggesting that this creates sys_redirect rows actually pointing to the selected site configuration (suggesting that redirects can be transferred between baseVariant setups without losing their functionality).
Updated by Andreas Kiessling about 1 year ago
I agree, that the current implementation needs to be improved.
In a multitree setup, an editor that should only be able maintain a single "domain", all sites/domains are listed and the editor could potentially screw up the other sites. Limiting that to the sites that he has access to could prevent that
Updated by Stefan P about 1 year ago
I understand that the current way makes it posible to create redirects for domains which are NOT in any site yaml. Which is also nice in some cases (to use TYPO3 as a general redirects processor, or for situations where a vHost just redirects all subdomains to the same web root as the parent domian as well - some hoster do this and you can not change it).
I propose that redirects created from site yamls are stored something like "t3://site?id=my-site" to be able to choose between just entering a source domain manually or tie it to a site yaml.