Is it possible to use the _redirects file to redirect that looks like this so that all instances where there is anything after the domain with a ?q= the redirect takes the user to the homepage via a 301 or alternatively a 404?
I’ve tried doing this several different ways and I can’t seem to get it to work.
Taking inspiration from here, does the following work for you?
/ q=:q /?redir 301!
- Run for requests made to
/ where a query parameter of
q=[value] is passed
301 redirect these requests to
- You must pass a dummy query parameter key like
?redir (without a value is fine) because, by default, the query parameter from the request is automatically passed through
- Force the rule (denoted by the
!) and will therefore always execute the rule, regardless of whether any pages under
Hope this helps!
That worked great thanks so much!