Case-sensitive URLs

Hello community! How can I implement a case sensitive URL in Kirby 3/4?

For example:

https://mysite.com/page-name - 200
https://mysite.com/Page-Name - 404

or

https://mysite.com/page-name - 200
https://mysite.com/Page-Name 301 redirect to https://mysite.com/page-name

Probably the easiest way is a route where you redirect urls with uppercase characters to their lowercase equivalent. Here’s a solution for K2 as a starting point: Not case sensitive URL? - #9 by louiswalch

To achieve the first, you can use a catch-all route that responds with a 404 if the pattern contains any uppercase letters.

To achieve the second, you would reroute all patterns that contain upper-case letters to their lower-case equivalents as already suggested by @stffr