Country Redirect Question

Hello

We have a physical file pricing.html
We use Pretty Urls. So final URL is site.com/pricing

An example we want to redirect site.com/pricing to site.com?country=nz

If we create a redirect rule as follows.
[[redirects]]
from = “/pricing.html”
to = “/?country=nz”
status = 301
force = true
conditions = {Country = [“nz”]}

When visiting site.com/pricing.html this works as expected.

If we visit site.com/pricing a redirect does not happen.

We created another redirect rule.

[[redirects]]
from = “/pricing”
to = “/?country=nz”
status = 301
force = true
conditions = {Country = [“nz”]}

This does not work either.

Thanks,
Matthew

Hey @skiltz

Those redirects are fine. I deployed a test happy-poincare-751dfa using them and in both cases when browsing from NZ (via VPN) I was redirected.

Do you have other redirects in the netlify.toml, or in a _redirects file? Rules are processed top down and _redirects first then netlify.toml as per documentation.

Yeah I do have a heap of redirect in the _redirect files. None of them to do with pricing however.

Do you have a redirect for /* in the _redirects file?

Nope. Best best bet would be for me to delete all in _redirect file and see if that fixes and add back in if that’s the case.

Test removing the _redirects. If that does fix things, then there is something in there stopping the pricing redirect working.

Thanks for the help much appreciated. This actually appears to be working now. I’m really not sure what I changed. But it’s resolved. Really appreciate the quick help. You are a wonderful person for helping the community.

1 Like

Great that it’s working @skiltz.

Perhaps the wind changed direction and blew everything into the correct place :man_shrugging: