Say I have people accessing routes, like:
helloworld.com/APP
HELLOWORLD.COM/APP
helloworld.com/app
Only the 3rd link works. The first and second one give me a 404.
How do I configure Flask to have case-insensitive routing, so that people can access my routes even if they type HeLloWoRLd.com/aPp
?
See this thread for a hackish way to do it, and also why it's probably not a good idea.
In short: URLs are case-sensitive by W3C standard, and making them case-insensitive will likely mess with search engine indexing of your site among other potential problems.
The recommended alternative approach is to code a custom 404 error handler which looks for the lower-case version of a mistyped URL and then redirects as appropriate.
Also note that the domain name itself isn't under flask's routing control anyway (and is actually case-insensitive already) -- so only the /app
part matters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With