的.htaccess或其他网址区分大小写 [英] .htaccess or other URL Case Sensitive

查看:503
本文介绍了的.htaccess或其他网址区分大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器是大小写敏感的,和id喜欢把它忽略不计。
我的意思的例子是
可以说,我上传Fruit.php
好了,然后去这个文件不会工作:
www.website.com/fruit.php
而将这样一句:
www.website.com/Fruit.php

有没有办法让Fruit.php和fruit.php是否行得通呢?还与目录。即:
/Script/script.php
/script/Script.php

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:
www.website.com/fruit.php
but this one will:
www.website.com/Fruit.php

Is there a way so Fruit.php and fruit.php will work? also with the directories. i.e:
/Script/script.php
/script/Script.php

推荐答案

区分大小写依赖于文件系统,而不是Apache的。然而有一个部分解决方案,。 mod_rewrite的可强制一切小写(或大写),像这样:

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}

参考: http://httpd.apache.org/docs/ 2.2 / MOD / mod_rewrite.html#RewriteMap指令

不幸的是,这只能如果所有的文件都是小写的,而您指定大小写混合的文件名(Fruit.php。)你舒服重命名项目中的小写字母的所有文件?

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?

这篇关于的.htaccess或其他网址区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆