distantnative / retour-for-kirby

Kirby CMS plugin to manage redirects and track 404s right from the Panel
https://distantnative.com/retour-for-kirby/
MIT License
135 stars 15 forks source link

Redirect URL with query strings #339

Open andykamezou opened 9 months ago

andykamezou commented 9 months ago

I have an old URL that looks like this: read.php?article=1-welcome-to-website

In the Failures tab, I can see Retour found the error in path read.php, but without the query string

I've tried to explicitly add a new redirect from the Routes tab:

But when trying to access the old URL, the page only redirected to Kirby's site error page; and I can see that the failures Hit count for news.php has increased. So it seems that Retour is ignoring it.

Is there any way to make this work?

Yoh7 commented 7 months ago

Same thing with an old wordpress path :

Kirby 4.1.2 Retour : 5.1.0

andykamezou commented 7 months ago

Same thing with an old wordpress path :

  • Path : ?page_id=2977
  • Redirect to : a page created through Kirby
  • Statut : 301 Retour is ignoring it...

Kirby 4.1.2 Retour : 5.1.0

What I understood after I opened this ticket was that Kirby's routing doesn't support URLs with querystring.

There's no reply from the dev, so maybe Retour will not add support for it.

You may consider Redirects instead: https://github.com/bnomei/kirby3-redirects. Last month they updated it to fix compatibility with Kirby 4.

distantnative commented 7 months ago

This is a bit tricky for me:

I found a way to support something like read.php?article=1-welcome-to-website. But then all redirects are very strict with queries. E.g. a redirect simply from /team to /about-us will stop working if requested as /team?filter=true or so.

distantnative commented 7 months ago

Not sure if I can offer support or https://github.com/bnomei/kirby3-redirects is indeed your better choice. The difference is that Retour is build on Kirby's routing - which doesn't support queries for route patterns. @bnomei has built their own matching function to see if a redirect should be applied to the current request.