Regex help. Lighttpd rewrite rule
I am not very familiar with Regular expression, but I am asked to modify a lighttpd rewrite rule.
url.rewrite = (
"^/(.+)/?$" => "/index.php/$1"
)
I want to exclude a path from the above greedy pattern, so that it won't fall back to index.php.
In words, it is simple: Match anything other开发者_如何学编程 than "statistics". But I just couldn't get it right in regex.
For example:
http://www.foo.com/anything/
→index.php/anything
http://www.foo.com/statistics/
→statistics/index.php
Would you please show me a hint to achieve that?
Thank you!
You probably want to use a negative lookahead. Something like
"^/(?!statistics)(.+)/?$" => "/index.php/$1"
And then you'll need an additional rule for statistics
精彩评论