如果目录存在,Htaccess更改URL案例

The problem I am having is that when the URL contains a directory that exists, the URL is getting changed the the case of the file.

More specifically, this is what is happening:

When I go to domain.com/cron/xxx then in my PHP script, uri will be:

cron/xxx

But if the folder Cron exists, then uri will be:

Cron/xxx

Does anyone know what causes this to happen?

Here is my .htaccess file:

RewriteEngine On

#remove www.
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^api
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?uri=api/$1 [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?uri=$1 [L,QSA]

I'm not super versed in ModRewrite, but you could try:

RewriteMap  lc int:tolower

and then use it in your rule like so:

RewriteRule (.*) ${lc:$1} [R=301,L]