Skip to content

Instantly share code, notes, and snippets.

@Mabahe
Created March 15, 2018 14:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mabahe/99a92f9b25878cfec3af9f400bde6568 to your computer and use it in GitHub Desktop.
Save Mabahe/99a92f9b25878cfec3af9f400bde6568 to your computer and use it in GitHub Desktop.
Migrate realurl redirects to sys_redirect (TYPO3 9 core)
INSERT INTO `sys_redirect` (source_path,target,hitcount,target_statuscode,source_host) SELECT CONCAT('/',url),destination,counter,301,d.domainName FROM `tx_realurl_redirects` r LEFT JOIN sys_domain d ON r.domain_limit = d.uid;
UPDATE sys_redirect SET source_host = '*' WHERE source_host = '';
@frans-beech-it
Copy link

If you want to migrate EXT:url_forwarding redirect (only internal without additional parameters + external)

INSERT INTO `sys_redirect` (source_path,target,hitcount,target_statuscode,source_host) SELECT CONCAT('/',forward_url),CONCAT('t3://page?uid=',internal_page),counter,http_status,d.domainName FROM `tx_urlforwarding_domain_model_redirect` r LEFT JOIN `tx_urlforwarding_domain_mm` mm ON r.uid = mm.uid_local LEFT JOIN `sys_domain` d ON mm.uid_foreign = d.uid WHERE r.type = 0;
INSERT INTO `sys_redirect` (source_path,target,hitcount,target_statuscode,source_host) SELECT CONCAT('/',forward_url),external_url,counter,http_status,d.domainName FROM `tx_urlforwarding_domain_model_redirect` r LEFT JOIN `tx_urlforwarding_domain_mm` mm ON r.uid = mm.uid_local LEFT JOIN `sys_domain` d ON mm.uid_foreign = d.uid WHERE r.type = 1;

UPDATE sys_redirect SET source_host = '*' WHERE source_host = '';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment