Case insensitive routes? #10207
-
Hello, We're using SvelteKit for our web sites, I wonder if there is a standardized way to make the routes case insensitive? Say I have the following routes structure: Then if I go to either /blog, /Blog, /BLOG, etc. in my browser I want to end up on the blog route. Any pointers would be appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You can try using matchers? (I’m not sure if this is the best way) The docs show an example of a matcher using a regex. So maybe something a regex with the case-insensitive flag? (I haven’t tested this) /** @type {import('@sveltejs/kit').ParamMatcher} */
export function match(param) {
return /^blog$/i.test(param);
} |
Beta Was this translation helpful? Give feedback.
I think it's even better to use the reroute universal hook