Rewrite subfolder ignored

I have the following rules in netlify.toml

[[redirects]]
  from = "/sb/*"
  to = "/sb/index.html"
  status = 200

[[redirects]]
  from = "/*"
  to = "/index.html"
  status = 200

The second rule is working as expected.

Even though

The redirects engine will process the first matching rule it finds

The first rule is being ignored so

https://mentors.codingcoach.io/sb/ redirects to https://mentors.codingcoach.io/ (the main page which is not working because the route doesn’t exists in the main app) instead of https://mentors.codingcoach.io/sb/index.html

Thanks

I don’t understand everything I know about this, but if you have Pretty URLs turned on in Asset Optimization, /sb/ should automagically serve /sb/index.html. Is it possible you have you a conflict between Pretty URLs and your redirect?

Thanks for your reply and sorry for the delay.
I wasn’t aware of Pretty URLs option. Indeed this options was checked. I turned it off but the problem is still happening.

Hi, @moshfeu, I don’t see this behavior when I test:

$ curl -svo /dev/null https://mentors.codingcoach.io/sb/  2>&1 | tail -n 15
* Connection state changed (MAX_CONCURRENT_STREAMS == 150)!
< HTTP/2 200
< cache-control: public, max-age=0, must-revalidate
< content-length: 956
< content-type: text/html; charset=UTF-8
< date: Wed, 25 Mar 2020 08:41:08 GMT
< etag: "b538cb54155d56247506edfde7a4c1b5-ssl"
< strict-transport-security: max-age=31536000
< age: 6
< server: Netlify
< x-nf-request-id: 48f0a12d-355c-4df6-91ae-22cac88abddc-3651349
<
{ [956 bytes data]
* Connection #0 to host mentors.codingcoach.io left intact
* Closing connection 0

This is a 200 response and not a redirect. Even in the browser with javascript running, there is no redirect for https://mentors.codingcoach.io/sb/.

If you still see the redirect, would you please send us the x-nf-request-id header for the redirect?

There more information about this header here:

If that header isn’t available for any reason, please send the information it replaces (or as many of these details as possible). Those details are:

  • the complete URL requested
  • the IP address for the system making the request
  • the IP address for the CDN node that responded
  • the day of the request
  • the time of the request
  • the timezone the time is in

If you prefer, you can also send us a HAR file capture of the redirect occurring instead. This will contain all those details, including the x-nf-request-id header.

If there are questions about any of this, please let us know.