Redirect working except for root

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.

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:

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