0

I need to redirect urls containing capital Cyrillic letters to lower Cyrillic letters as they generate 404 errors on the website.

I have tried this:

RewriteEngine On
RewriteCond %{REQUEST_URI} [A-ZА-Я]
RewriteRule ^(.*)$ /${tolower:$1} [R=301,L]

But it appears not to be working. I still get the 404 error. When I try to visit this:

https://mywebsite.com/Продукт

I expect to be redirected to: https://mywebsite.com/продукт

but instead I get a 404 error. I am using litespeed webserver but as far as I know it uses the .htaccess file.

What could potentially solve this?

2
  • 1
    I'm guessing tolower probably covers the English alphabet only. Might be easiest if you rewrite those requests to an actual script (PHP or something), that does the "lowering" of the characters, and then performs the redirect via header('Location: ...');
    – CBroe
    Commented Apr 29 at 13:47
  • "but instead I get a 404 error" - if you are not getting a 301 redirect at all then the tolower "rewrite map" is not even being called. @CBroe (Assuming you have defined a tolower rewrite map in the server config that calls the corresponding tolower internal function?) If you are not getting a redirect then either the condition (RewriteCond directive) is failing, OR if you've not defined the rewrite map then (on LiteSpeed) the entire rule is simply failing silently (an error should still be logged as the rewrite map is undefined) and nothing actually happens.
    – MrWhite
    Commented May 6 at 17:19

0