How to remove query params completely from redirect?

Hello everyone,

I’m trying to redirect some urls such as:

from blog/icerik-plani?ltclid=5103aae2-56d0-4a80-a6c2-372dee92d38f
to blog/icerik-plani/

or there could be more query params.

I wrote my redirects in netlify.toml file like this:

[[redirects]]
  from = "/blog/icerik-plani?ltclid=5103aae2-56d0-4a80-a6c2-372dee92d38f"
  to = "/blog/icerik-plani/"
  status = 301
  force = false

However, it doesnt work. It always shows query params in the url. I am sorry if its clearly stated in documents, I couldn’t find any information in query params docs or redirects docs for my problem.

Thanks!

hey there hasanmuzak,

i have some thoughts on this.

first, are you sure your redirects are being processed?

secondly, you’ll want to probably use a splat in order to capture everything that has a query param:

thirdly, it does look like the rest of your syntax for the redirect is correct. Have you been successfully able to redirect another URL without a query param and seen the URL change?

Thank you for your answer perry,

My problem was that I didn’t notice the sorting of my redirects. I had several redirects above this one, so actually it was calling some of them and it was causing this problem.

I can’t believe I forgot something that simple and spent like 6-7 hours to fix it. haha :smiley:

Now it works perfectly.

1 Like

fantastic. thanks for letting us know!