2010-08-19 115 views
1

我对正则表达式不是很熟悉,但要求我修改lighttpd重写规则。正则表达式的帮助。 Lighttpd重写规则

url.rewrite = (
    "^/(.+)/?$" => "/index.php/$1" 
) 

我要排除上述的贪婪模式的路径,所以它不会回落到的index.php

换言之,很简单:匹配“统计”以外的任何内容。但是我不能正确使用正则表达式。

例如:

  • http://www.foo.com/anything/index.php/anything
  • http://www.foo.com/statistics/statistics/index.php

请你告诉我一个提示,实现这一目标?

谢谢!

回答

6

您可能想要使用负面预测。喜欢的东西

"^/(?!statistics)(.+)/?$" => "/index.php/$1" 

然后你需要为统计

的附加规则