Routing old urls to new urls in migrated site

I’ve migrated a site from WP to Kirby -very dirty endeavour- and for several reasons it was not possible to keep the original urls, for example became http:/

Many of these pages are well indexed in search engines and I’d like to route/redirect old urls to new urls, and as most pages have the format you see above, it seems programatically feasible.

But, where do you reccomend I do this?

My initial ideas:

  • Using a route that covers almost all possible urls that, when receiving an incorrect url, tries to see if there may be a similar correct url match (as in the example above)
  • Doing the same in the error page with a redirect
  • Using more specific routes, such as one for each of artists/, exhibitions/, fairs/, artworks/ but doing more or less the same than above

Thank you

It depends a bit on how many urls you have to rewrite. Maybe this plugin might help you: GitHub - distantnative/retour-for-kirby: Kirby 3 plugin to manage redirects and track 404s right from the Panel

If there are a lot of urls, I would try to use regex patterns in a route to create redirects, if that’s possible.

Why are the numbers added to the url? Can’t you change the slug?

Thank you,

I am actually going the other way around and, as you suggest, removing the numbers from the urls, as the cases where this was needed are not so many, and it makes more sense dealing with those even if manually, than rerouting everything everytime.

Now my question is, how do I update a page’s url ? is it enough to modify the slug?

perhaps I should open another question for this,


1 Like

For just a few reroutes, using a route is good enough.

If you really had reroutes for every single page, I’d do this on the server level (server configuration, .htaccess), i.e. before PHP kicks in, because that’s faster/more efficient.