you can use rewritemap : https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritemap
this is an apache function and supported by both apache and litespeed.
example code:
https://httpd.apache.org/docs/2.4/rewrite/rewritemap.html#int
RewriteMap lc int:tolower
RewriteRule "(.*)" "${lc:$1}"...