使用 mod_rewrite 区分大小写的 URL [英] Case Insensitive URLs with mod_rewrite
问题描述
我想要任何未命中现有文件的 url,对其他可能的情况进行查找,看看这些文件是否存在,如果存在,则向它们发送 302.
I'd like for any url that doesn't hit an existing file, to do a lookup on the other possible cases and see if those files exist, and if so, 302 to them.
如果这是不可能的,那么我可以接受这些妥协:
If that's not possible, then I'm ok with these compromises:
- 只检查小写版本
- 只检查第一个路径部分
例如 http://example.com/CoOl/PaTH/CaMELcaSE 应该重定向到http://example.com/cool/path/camelCase(假设后者存在).
For example http://example.com/CoOl/PaTH/CaMELcaSE should redirect to http://example.com/cool/path/camelCase (assuming the latter exists).
当然,完整的解决方案对我和其他人来说更有用
but of course a full solution is much more useful to me and others
推荐答案
CheckSpelling on
匹配文件和目录.有关详细信息,请参阅文档.
Matches files and directories. See the documentation for details.
这篇关于使用 mod_rewrite 区分大小写的 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!