T
TanStack3w ago
national-gold

Index route without trailing `/` ?

So, I've gone through many pages in the docs and all ai models i have access to and concluded that there is no way to have my website work from a clean url without a trailing / like myapp.com/dashboard where dashboard is my router's basepath the only way this will work is if I add the trailing / like myapp.com/dashboard/ otherwise it will be the not found component is there really no way to make this work without the trailing /? PS: i love this router ❤️
3 Replies
xenial-black
xenial-black3w ago
https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#trailingslash-property In the place you call createRouter, you can pass this property. It defaults to "never" though, so you might have customized it in the first place
RouterOptions | TanStack Router React Docs
The RouterOptions type contains all of the options that can be used to configure a router instance. RouterOptions properties The RouterOptions type accepts an object with the following properties and...
national-gold
national-goldOP3w ago
i did try that but didn't fix the not found on /dashboard only /dashboard/ works :/ thanks for answering! looks like it was a bug in version 1.32.0 of the router, just upgraded to 1.34.13 and now it works with and without trailingSlash lol
xenial-black
xenial-black3w ago
That is interesting

Did you find this page helpful?