How to redirect to a subdomain

Hello guys, sorry if this sounds off. I’m using Netlify for the first time and I need to set up redirect rule for my domain in a react app. Let say I have an app on www.example.com and I have a subdomain for staging (www.staging.example.com). After a user successfully logs in, I want my user redirected to www.dashboard.staging.example.com instead of www.staging.example.com/dashboard.

Illustration

on production : www.example.com/dashoard --> www.dashboard.example.com
on staging: www.staging.example.com --> www.dashboard.staging.example.com

What I have tried

[[redirects]]
from = "https://dashboard.example.com/*"
to = "https://example.com/dashboard/:splat"
status = 200
force=true

[[redirects]]
from = "https://dashboard.staging.example.com/*"
to = "https://staging.example.com/dashboard/:splat"
status = 200
force=true

Those should work; syntax looks good. I’d guess we didn’t process those redirects in your deploy, or you have the hostnames wrong, or something. Mind telling me the deploy ID for one where you think you had them added so I can check it out and see what we processed into our database and maybe advise?

The deploy ID is the last “hash” in the URL for the logs page for that deploy.

Thanks for your response. This is the hash of my last deployment 5de7c3fb67f305000896c2a0

Hi @timi-codes!

I think your redirects are not coming in the order you are expecting them too. Redirects are read from the top down, so if you switch the order this should work much better for you.