Redirect with query param

Hi, i have a site: https://bestcaliforniamovers.com/

And i want to use rule like this one /* t=:value1 /:value1 302 in _redirects file.
so urls like
https://bestcaliforniamovers.com/?t=bing will become https://bestcaliforniamovers.com/bing/
But by some reason its not working, can you help me figure out why
Thank you

Hi @bestcaliforniamovers,

Don’t you mean 301 instead of 302?

It might also be caching, try in another browser which you didn’t use yet.
Or maybe even try private browsing for testing purposes.

Gr,

Andy

I wanted to test it for first time, with 302 and then use 301

Even this exact rule not working

/?t=123 /123

Can you help me please?
Thank you

Did you try to redirect by using the netlify.toml file yet?

@bestcaliforniamovers, you need to use 302! (the ! is important).

1 Like

@hrishikesh works with 302!, but now i got too many redirects. Cause redirect leave query params in url

Documantation says:

/store id=:id  /blog/:id  301

The following match redirects a URL like: /store?id=my-blog-post to /blog/my-blog-post with a 301 redirect. This affects request URLs with an id query parameter only.

But i got /blog/my-blog-post?id=my-blog-post

My rules looks like: /* t=:value1 /:value1 302!

Query params are preserved when redirecting unless you override them. So you ca change the redirect to:

/store id=:id /blog/:id?redirected=true 302!

or any other query param for that matter