[英]Convert to lowercase in a mod_rewrite rule
I would like URLs like server.com/foo to be case-insensitive.我希望诸如server.com/foo之类的URL不区分大小写。 But server.com/foo actually gets mod_rewrite'd to server.com/somedir/foo
但是server.com/foo实际上被mod_rewrite到server.com/somedir/foo
(Assume that all the files in "somedir" are lower case.) (假定“ somedir”中的所有文件均为小写。)
So the question is, how to accomplish a mod_rewrite like the following:因此,问题是,如何完成如下所示的mod_rewrite:
RewriteRule ^([^/]+)/?$ somedir/convert_to_lowercase($1)
PS: Here's a handy mod_rewrite cheat sheet -- http://dreev.es/modrewrite -- though it fails to answer this particular question. PS:这里有一个方便的mod_rewrite作弊表- http://dreev.es/modrewrite -尽管它不能回答这个特定问题。
PPS: Thanks to Bee and Ignacio for all the help with this. PPS:感谢Bee和Ignacio在此方面的所有帮助。 Also, here's a related question: RewriteMap activation
另外,这是一个相关的问题: RewriteMap激活
I would like URLs like server.com/foo to be case-insensitive.我希望诸如server.com/foo之类的URL不区分大小写。 But server.com/foo actually gets mod_rewrite'd to server.com/somedir/foo
但是server.com/foo实际上被mod_rewrite到server.com/somedir/foo
(Assume that all the files in "somedir" are lower case.) (假定“ somedir”中的所有文件均为小写。)
So the question is, how to accomplish a mod_rewrite like the following:因此,问题是,如何完成如下所示的mod_rewrite:
RewriteRule ^([^/]+)/?$ somedir/convert_to_lowercase($1)
PS: Here's a handy mod_rewrite cheat sheet -- http://dreev.es/modrewrite -- though it fails to answer this particular question. PS:这里有一个方便的mod_rewrite作弊表- http://dreev.es/modrewrite -尽管它不能回答这个特定问题。
PPS: Thanks to Bee and Ignacio for all the help with this. PPS:感谢Bee和Ignacio在此方面的所有帮助。 Also, here's a related question: RewriteMap activation
另外,这是一个相关的问题: RewriteMap激活
I would like URLs like server.com/foo to be case-insensitive.我希望诸如server.com/foo之类的URL不区分大小写。 But server.com/foo actually gets mod_rewrite'd to server.com/somedir/foo
但是server.com/foo实际上被mod_rewrite到server.com/somedir/foo
(Assume that all the files in "somedir" are lower case.) (假定“ somedir”中的所有文件均为小写。)
So the question is, how to accomplish a mod_rewrite like the following:因此,问题是,如何完成如下所示的mod_rewrite:
RewriteRule ^([^/]+)/?$ somedir/convert_to_lowercase($1)
PS: Here's a handy mod_rewrite cheat sheet -- http://dreev.es/modrewrite -- though it fails to answer this particular question. PS:这里有一个方便的mod_rewrite作弊表- http://dreev.es/modrewrite -尽管它不能回答这个特定问题。
PPS: Thanks to Bee and Ignacio for all the help with this. PPS:感谢Bee和Ignacio在此方面的所有帮助。 Also, here's a related question: RewriteMap activation
另外,这是一个相关的问题: RewriteMap激活
I would like URLs like server.com/foo to be case-insensitive.我希望诸如server.com/foo之类的URL不区分大小写。 But server.com/foo actually gets mod_rewrite'd to server.com/somedir/foo
但是server.com/foo实际上被mod_rewrite到server.com/somedir/foo
(Assume that all the files in "somedir" are lower case.) (假定“ somedir”中的所有文件均为小写。)
So the question is, how to accomplish a mod_rewrite like the following:因此,问题是,如何完成如下所示的mod_rewrite:
RewriteRule ^([^/]+)/?$ somedir/convert_to_lowercase($1)
PS: Here's a handy mod_rewrite cheat sheet -- http://dreev.es/modrewrite -- though it fails to answer this particular question. PS:这里有一个方便的mod_rewrite作弊表- http://dreev.es/modrewrite -尽管它不能回答这个特定问题。
PPS: Thanks to Bee and Ignacio for all the help with this. PPS:感谢Bee和Ignacio在此方面的所有帮助。 Also, here's a related question: RewriteMap activation
另外,这是一个相关的问题: RewriteMap激活
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.