Is there any way to make _redirects case-insensitive?

My _redirects file looks like so:

/github https://github.com/pexeixv
/codepen https://codepen.io/pexeixv

It works fine when I type /github, but does not when /GITHUB or /GitHub is typed.
Is there a way to make these redirects case insensitive, other than added all the possible case combinations to _redirects?

Maybe some sort of a header to the file which tells Netlify that redirects should be case-insensitive. I’m just taking a guess.

1 Like

URLs are case-sensitive for anything after the domain name, so sadly what you’re looking for is not really a Netlify limitation as they’re 2 separate URLs.

What you’re looking for is possible using Edge Handlers. You can check for the URL, convert it to lowercase and redirect accordingly. But, it’s still in invite-only stage.

What you can do is, create a page on your website to redirect to and redirect using JavaScript. So, you can create something like, yourwebsite.com/redirect/?=github (case-insensitive) and using JavaScript, get the query parameter, convert it to lowercase and redirect accordingly.

If you don’t want client-side redirect, you’ll have to add all combinations of URLs to your _redirects.

1 Like