Query redirect won't work in some cases

For some reason this works :

[[redirects]]
  from = "/doku.php"
  to = "/public/general/win_gui_usage/?no-query-string"
  status = 301
  force = true

but this does not:

[[redirects]]
  from = "/doku.php?id=public:general:command_line_usage"
  to = "/public/general/command_line_usage?no-query-string"
  status = 301
  force = true

Can someone tell me why? Thanks

I think what youre looking for is the query field: File-based configuration | Netlify Docs

[[redirects]]
  from = "/doku.php"
  to = "/public/general/command_line_usage?no-query-string"
  query={id = "public:general:command_line_usage"}
  status = 301
  force = true

Hope this helps!

3 Likes

@AaronP Yes, thanks this works. So I’m assuming it checks if the query is equal to the value in the query field and then selects the redirect rule to the new site?

I believe that is correct, you can also use slugs :id to pass them onwards specifically, by default all query parameters will be passed on otherwise :slight_smile:

Have a good day!