Dolphiq / craft-plugin-redirect

Craft 3 redirect plugin provides an easy way to enter and maintain 301 and 302 redirects and 404 pages. The plugin provides a clear user interface for admin and non-admin users.
MIT License
54 stars 34 forks source link

Craft 5 support #141

Open roelvanhintum opened 7 months ago

roelvanhintum commented 7 months ago

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

pbd-dev commented 7 months ago

Hi, any update on Craft 5 timeline?

TUSAB-web commented 6 months ago

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

Siyabulela commented 6 months ago

Co-ask

cyberfly999 commented 5 months ago

Same question here...

klaus-gsma commented 5 months ago

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
celo4ever commented 4 months ago

Same here, any updates?

TUSAB-web commented 4 months ago

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.

99ster commented 3 months ago

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!

TUSAB-web commented 3 months ago

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.