Hi,
We have 2 redirect rules like this in our .toml file (just changed the domain name):
[[redirects]]
from = "https://blog.example.com/*"
to = "https://example.com/blog/:splat"
[[redirects]]
from = "https://blog.example.com"
to = "https://example.com/blog"
force = true
Redirection is working for blog.exemple.com/ any-path-name/
Problem is, blog.exemple.com alone is not redirected (we added the 2nd rule in case the 1st one was not enough, but it didn’t help).
We don’t have redirects in /public or elsewhere.
The blog subdomain is added as a domain alias on Netlify and there is a CNAME pointing to our Netlify app path.
Thanks for any help.
perry
May 28, 2021, 9:42pm
2
hi there, before we dig in, did you see this brand new guide on debugging redirects?
I strongly suggest you give it a thorough read through and see if this fixes your problem:
Last checked by Netlify Support Team: September 2023.
Introduction
You’ve put blood, sweat and tears into building an incredible static site with all the bells and whistles. However, you’ve configured some redirect rules and you’ve come unstuck… they don’t appear to be working!
Ensure you’ve followed the correct guidance
Our redirects and rewrites document covers a broad range of use cases, from status codes to proxying another service and everything in between.
Ensure you’re using the correc…
if not, please post again, and we’ll try and troubleshoot.
Also, apart from what @perry suggested above, adding force = true
to the first rule should work.
There might be a chance you have an index.html
in your website’s root. Netlify won’t redirect if the path exists unless forced .
Let us know how it goes.
1 Like