Redirect migration wizard creates wrong redirects
When updating from TYPO3 8 to 9 and when having domain records with redirects for example for redirecting a subdomain without www to the one with www, the update migration wizard 'Install system extension "redirects" if a sys_domain entry with redirectTo is necessary' creates wrong redirects.
For example if you had a domain record in 8 for domain "test.com" having the redirect target "https://www.test.com/", the migration wizard creates a redirect with an empty source domain and the source path "/test.com/", which is not correct. It should have been source domain "test.com" and source path "/". When correcting this manually after the upgrade wizard, it works fine.
Updated by Stefan Berger almost 2 years ago
I could confirm the issue.
$sourceDetails is generated with
parse_url. If the domain is like test.com, it will be extracted as path.
This fix our situation:
diff -r a/typo3/sysext/install/Classes/Updates/RedirectsExtensionUpdate.php b/typo3/sysext/install/Classes/Updates/RedirectsExtensionUpdate.php 172a173,174 > $sourceDetails['host'] = $domainName; > $sourceDetails['path'] = str_replace($domainName, '', $sourceDetails['path']);
Updated by Tobias Schmidt almost 2 years ago
To fix this bug change
$sourceDetails = parse_url($domainName); to
$sourceDetails = parse_url('//' . $domainName); in sysext/install/Classes/Updates/RedirectsExtensionUpdate.php. As the domain name of a domain record must not start with a scheme and/or double slashes the domain name must be prefixed with double slashes in the
parse_url call to recognize the domain name as host and not as path. See Example #2 A parse_url() example with missing scheme in PHP documentation.