重写index.html的任何组合

时间:2017-05-10 11:22:48

标签: regex apache http url url-rewriting

我感兴趣的是将index.html的任何字母大小写组合的URL重定向到index.html的全部小写。

即:

/foo/bar/INDEX.html
to 
/foo/bar/index.html

or

/hello/world/funk/indeX.HTML
to 
/hello/word/fund/index.html

我试过几个正则表达式,但没有运气。我只对index.html

中有任何大写字母感兴趣

/hello/there/index.html 不应该在任何地方重定向。

我可以访问httpd.conf,因此我使用的是RewriteMap lc int:tolower

1 个答案:

答案 0 :(得分:1)

试试这个:(?!index\.html)(?i)index\.html(?-i)它首先检查字符串是否不是index.html,然后匹配不区分大小写index.html的任何字符串。在这里试试:https://regex101.com/r/GNhAwG/1

相关问题