.htaccess or other URL Case Sensitive

后端 未结 3 836
天涯浪人
天涯浪人 2020-12-17 06:56

My server is Case Sensitive, and id like to turn it to inSensitive.
Example of what I mean is
lets say I upload Fruit.php
Well then going to this file wont work:

3条回答
  •  独厮守ぢ
    2020-12-17 07:47

    Case sensitivity depends on the file system, not Apache. There is a partial solution, however. mod_rewrite can coerce everything to lowercase (or uppercase) like so:

    RewriteMap tolowercase int:tolower 
    RewriteRule ^(.*)$ ${tolowercase:$1}
    

    Reference: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap

    Unfortunately, this only works if all your files are lowercase, while you specifies mixed case filenames (Fruit.php.) Are you comfortable renaming all the files in your project lowercase?

提交回复
热议问题