I need capital/lowercase to be seen the same

Hello - I would like my urls to always be lower case…and if somehow I accidentally type an uppercase in a link to always redirect to the lower case link. Right now I’m getting a 404 error if I accidentally type in browser the upper case version.

for example:
/free-tools is my url
but if I type in browser:
/Free-tools it gives 404 error.

How can I create a rule to disregard the case of capitals and always redirect to lower case? Thank you!

If you can’t configure your server to accommodate this, you can do so with a Worker:

If it’s not important to have an actual redirect, and you just want CF to serve the response as if it was lowercase (which includes using the correct cache key for static files) then you can use a Transform Rule:

https://developers.cloudflare.com/rules/transform/url-rewrite/create-dashboard
https://developers.cloudflare.com/rules/transform/url-rewrite/examples
https://developers.cloudflare.com/firewall/cf-firewall-language/functions#transformation-functions

URL Rewrite > Path > Dynamic > lower(http.request.uri.path)

Unlike the Worker solution, this incurs no additional costs.

2 Likes

Thanks for that. I tried looking at Transform as an option, but didn’t think to check the dev docs.

1 Like

Okay thank you so much.

Transform Rules are really neat. Another cool trick is URL Rewrite > Query > Static > [Nothing] to combine the effects of Cache Everything with No Query String, which you normally can’t select at the same time.

I’m using that and a few more to reduce the chance of unwanted automated downloads bypassing Cloudflare cache and causing unwanted egress costs at upstream cloud storage provider.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.