craft-plugin-redirect icon indicating copy to clipboard operation
craft-plugin-redirect copied to clipboard

Craft 5 support

Open roelvanhintum opened this issue 1 year ago • 9 comments

Hi, thanks for the plugin! Are there any plans for Craft 5 support?

roelvanhintum avatar Apr 22 '24 08:04 roelvanhintum

Hi, any update on Craft 5 timeline?

pbd-dev avatar Apr 30 '24 13:04 pbd-dev

Just wanted to bump this - are there plans to update this for Craft 5 or do should we find other solutions?

TUSAB-web avatar May 11 '24 14:05 TUSAB-web

Co-ask

Siyabulela avatar May 28 '24 13:05 Siyabulela

Same question here...

cyberfly999 avatar Jun 06 '24 15:06 cyberfly999

We have migrated to retour which has much better performance as well (if you have lots of redirects).

This is the migration I created:

    public function safeUp(): bool
    {
        $sql = "INSERT INTO `retour_static_redirects` (`dateCreated`, `dateUpdated`, `uid`, `siteId`, `associatedElementId`, `enabled`, `redirectSrcUrl`, `redirectSrcUrlParsed`, `redirectSrcMatch`, `redirectMatchType`, `redirectDestUrl`, `redirectHttpCode`, `hitCount`, `hitLastTime`)
                SELECT
                    `d`.`dateCreated`,
                    `d`.`dateUpdated`,
                    `d`.`uid`,
                    `s`.`siteId`,
                    0 AS `associatedElementId`,
                    `e`.`enabled`,
                    `src`.`redirectSrcUrl`,
                    `src`.`redirectSrcUrl` AS `redirectSrcUrlParsed`,
                    'pathonly' AS `redirectSrcMatch`,
                    'exactmatch' AS `redirectMatchType`,
                    `d`.`destinationUrl` AS `redirectDestUrl`,
                    609 - `d`.`statusCode` AS `redirectHttpCode`,
                    `d`.`hitCount`,
                    `d`.`hitAt` AS `hitLastTime`
                FROM (
                    SELECT 
                        `dolphiq_redirects`.`id`,
                        IF(`dolphiq_redirects`.`sourceUrl` NOT LIKE '%<%', 
                            CONCAT('/', `dolphiq_redirects`.`sourceUrl`), 
                            CONCAT(
                                '/',
                                SUBSTRING(`dolphiq_redirects`.`sourceUrl`, 1, LOCATE('<', `dolphiq_redirects`.`sourceUrl`) - 1),
                                '[^/]+',
                                SUBSTRING(`dolphiq_redirects`.`sourceUrl`, LOCATE('>', `dolphiq_redirects`.`sourceUrl`) + 1)
                            )
                        ) AS `redirectSrcUrl`
                    FROM `dolphiq_redirects`
                ) AS `src`
                JOIN `dolphiq_redirects` `d` ON `d`.`id` = `src`.`id`
                JOIN `elements` `e` ON `d`.`id` = `e`.`id`
                JOIN `elements_sites` `s` ON `d`.`id` = `s`.`elementId`";

        $this->execute($sql);
        $this->execute('CREATE TABLE dolphiq_redirects_backup AS SELECT * FROM dolphiq_redirects;');
        $this->execute('TRUNCATE TABLE dolphiq_redirects');

        return true;
    }
    ```
    
    Worked perfectly for us but no guarantees that it'll work for you - please check it and test it before using in production

klaus-gsma avatar Jun 06 '24 16:06 klaus-gsma

Same here, any updates?

celo4ever avatar Jul 26 '24 09:07 celo4ever

I am considering doing an export of my records and using Sprout Redirects. It has been updated for Craft 5 and has a free tier that should meet our needs. If this repo hasn’t been updated by the time I finish, I will post the results of my attempt here.

TUSAB-web avatar Jul 26 '24 17:07 TUSAB-web

I am considering doing an export of my records and using Sprout Redirects. It has been updated for Craft 5 and has a free tier that should meet our needs. If this repo hasn’t been updated by the time I finish, I will post the results of my attempt here.

Being able to do a bulk import into Sprout Redirects has proved to be too big a challenge for me. If you're able to get that to work please post your method here. Thanks!

99ster avatar Aug 02 '24 14:08 99ster

I am considering doing an export of my records and using Sprout Redirects. It has been updated for Craft 5 and has a free tier that should meet our needs. If this repo hasn’t been updated by the time I finish, I will post the results of my attempt here.

Being able to do a bulk import into Sprout Redirects has proved to be too big a challenge for me. If you're able to get that to work please post your method here. Thanks!

I wasn’t able to figure it out. I saw in Sprout’s documentation they mentioned an SEO import helper. I could not find it. Also, there doesn’t seem to be a way to import with FeedMe (the Sprout entries aren’t exposed in the CP as entries that can be imported into).

It seems like paying for Retour and using the migration above will be the easiest way if you have a lot of redirects to import. I looked through the list on the site I’m updating and many redirects are out-of-date and not worth saving, so I’ll just re-enter the essential ones by hand into Sprout.

TUSAB-web avatar Aug 02 '24 15:08 TUSAB-web