Issue with redirect rules and mandatory query params

Hi,

I’m fairly new to Netlify and I’ve deployed a Gatsby website with Deploy preview.
I’m trying to implement some redirect rules for my website https://6022c19af9d5412132af8789–objective-hamilton-f45bdd.netlify.app

Here is my netlify.toml file:

[[redirects]]
  from = "/produits/*"
  to = "/realisations"

[[redirects]]
  from = "/reseau-artisans"
  to = "/artisans"

[[redirects]]
  from = "/label-artisan"
  to = "/artisans"

[[redirects]]
  from = "/communaute-artisans"
  to = "/artisans"

[[redirects]]
  from = "/trouver-un-artisan"
  to = "/artisans"

[[redirects]]
  # TODO: Créer la page
  from = "/service-sur-mesure"
  to = "/"

[[redirects]]
  # TODO: Créer la page
  from = "/service-architectes"
  to = "/"

[[redirects]]
  # TODO: Créer la page
  from = "/service-artisans"
  to = "/"

[[redirects]]
  from = "/contactez-nous"
  to = "/contact"

[[redirects]]
  from = "/nous-contacter"
  to = "/contact"

[[redirects]]
  from = "/blog"
  query = {categorie = ":categorie"}
  to = "/blog/categorie/:categorie"

[[redirects]]
  from = "/materiautheque"
  query = {categorie = ":categorie"}
  to = "/materiautheque/type-de-materiau/:categorie"

[[redirects]]
  from = "/realisations"
  query = {type = ":type"}
  to = "/realisations/type-de-projet/:type"

The first rules are working:
I tested /produits/aih which redirects to /realisations
I tested /contactez-nous which redirects to /contact

But when I enter the following url : /blog?categorie=actualites I’m not redirected to /blog/categorie/actualites

I’m I doing something wrong?

Thank you for your help!

Maybe you can try adding force = true.

Thank you for your answer.

I saw this configuration parameter in the documentation, but I don’t understand it.

I just deployed https://6022e0e2adadb300bae52fb6–objective-hamilton-f45bdd.netlify.app with the following configuration:

[[redirects]]
  from = "/blog"
  query = {categorie = ":categorie"}
  to = "/blog/categorie/:categorie"
  force = true

But /blog?categorie=actualites still doesn’t redirect to /blog/categorie/actualites.

It works when you you see with a trailing slash: https://6022e0e2adadb300bae52fb6--objective-hamilton-f45bdd.netlify.app/blog/?categorie=abc

You’re right, it works with /blog/?categorie=abc.

My question is: why it doesn’t work with /blog?categorie=abc?

By creating the rule:

[[redirects]]
  from = "/blog"
  query = {categorie = ":categorie"}
  to = "/blog/categorie/:categorie"
  force = true

I wanted to match /blog?categorie=abc and not /blog/?categorie=abc

If I wanted to match /blog/?categorie=abc, wouldn’t the rule be:

[[redirects]]
  from = "/blog/"
  query = {categorie = ":categorie"}
  to = "/blog/categorie/:categorie"
  force = true

/blog/ is same as /blog in many cases. However, I don’t know why it’s working with just one of the two cases.