We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Redirect with entry id

Kenny Horna October 14, 2020 by Kenny Horna

Given the existing article path:


How could I resolve/redirect to the same article after the slug is updated? For example

Desired behavior:

If I visit: articles/123456/a-cool-entry Then, it's redirected to the updated URL: articles/123456/a-cool-entry-updated

So basically, the article identifier should be the {id} and then fetch that entry to redirect to the correct path.

I'd like to make this if the url isn't found, as a fallback in case it was updated for some reason (for example a tutorial to Airlock that now should refer to Sanctum instead).

In common Laravel I'd search for the {id} to then construct the correct url to redirect, but I don't know how to handle this using Statamic

Thanks in advance :)

>>>>>>> Unanswered <<<<<<<
1 Reply