Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect URL with query strings #339

Open
andykamezou opened this issue Jan 24, 2024 · 4 comments
Open

Redirect URL with query strings #339

andykamezou opened this issue Jan 24, 2024 · 4 comments
Labels
bug 🐛 Something isn't working help needed 🙌 Can't do it myself

Comments

@andykamezou
Copy link

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:

  • Path: read.php?article=1-welcome-to-website
  • Redirect to: a page created through Kirby.

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
Copy link

Yoh7 commented Mar 25, 2024

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

@andykamezou
Copy link
Author

andykamezou commented Mar 25, 2024

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 distantnative added the bug 🐛 Something isn't working label Mar 29, 2024
@distantnative distantnative added this to the 5.2.0 milestone Mar 29, 2024
@distantnative
Copy link
Owner

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
Copy link
Owner

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.

@distantnative distantnative changed the title Redirect old URL which contains a specific query strings Redirect URL with query strings Mar 29, 2024
@distantnative distantnative added the help needed 🙌 Can't do it myself label Mar 29, 2024
@distantnative distantnative modified the milestones: 5.2.0, 5.3.0 Mar 29, 2024
@distantnative distantnative removed this from the 5.3.0 milestone May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working help needed 🙌 Can't do it myself
Projects
None yet
Development

No branches or pull requests

3 participants