Redirect not working for 404 with query

I am trying to redirect the url with status 404 and having specific query parameter to homepage.

example ,

en-us/product1/xyz.html?lang-switch=true # if this url is 404 status

en-us/product1/index.html #this should be the redirected url

Here is the redirect rule I have written

query parameter is lang-switch

[[redirects]]
  from = "/:lang/:product/*"
  to = "/:lang/:product/index.html"
  status = 404
  query = {lang-switch = ":lang-switch"}

This rule is still showing 404.
How to solve this use case?

Thank you

Hi @rishank :wave: ,

Welcome to the community! Your redirect rule looks mostly okay but perhaps adding a force redirect force = true would help?

Could you give that a try and let us know if that helps? If not, could you share the site_id so we can take a closer look?