I set redirects with the netlify.toml and using a cookie to define the country code (nf_country).
The redirects work, but with your second visit within the session. The first visit returns 404 (this page doesn’t exists). Unfortunately, it has an impact on our SEO results. The URL returns 404 in the SEO crawlers instead of the redirected site.
test example:
[[redirects]]
from = "/angstpatienten/"
to = "https://<here_is_my_original_domain>.es"
status = 301
force = true
conditions = {Country = ["ES"]}
Hi Perry!
Thank you for the support guide. Unfortunately, I couldn’t find a way out
Maybe some additional info that could help you in the investigation:
we are using Gatsby,
I am trying to redirect to our different project on Netlify. But the domain for this project we are trying to redirect to is a custom one and is proxying through Cloudfront to Netlify.
I don’t understand why the redirect doesn’t work on the first visit (within one session), but works on the refresh.
You’ll want to make sure that the rule you have specified in your first post is at the top of your redirects file. Then, below it, I believe you’ll want a SPA redirect:
Ok, so today it started working in the browser. Unfortunately SEO tools still returns 404.
The order of the redirect is correct. We are redirecting to a different domain and the examples for SPA are pointing to the same one, so I guess are not for us, but I also tried with /index.html. I don’t want to redirect all the subpages from 404 to the custom domain. Only some particular one. So I also checked this Rewrites and proxies | Netlify Docs
I also tried with the /index.html slug
[[redirects]]
from = "/angstpatienten/"
to = "https://<here_is_my_original_domain>.es/index.html"
status = 301
force = true
conditions = {Country = ["ES"]}
No, I am redirecting one per redirect. But we have many, almost the same redirects for different pages.
We are also using splat in different redirect, but this is not this case
If you wouldn’t mind getting an x-nf-request-id for a request made on your site, I can gather the site information and take a look at your actual redirects and traffic
Hey there! I did indeed. Unfortunately, the redirect rule works for me.
Using a VPN, from Madrid, if I request /angstpatienten from that deploy URL, I am directed to the .es domain. This is true in both Safari and Chrome, with or without the cache.
This is also true for the FR redirect, which redirects me to the .fr domain accurately when I appear in Paris.
If this is still an issue, can you provide me with a x-nf-request-id for a request to the /angstpatienten page when it doesn’t redirect?