hoball
hoball

Reputation: 3226

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:

Would you please show me a hint to achieve that?

Thank you!

Upvotes: 1

Views: 1579

Answers (1)

JonNeale
JonNeale

Reputation: 319

You probably want to use a negative lookahead. Something like

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

And then you'll need an additional rule for statistics

Upvotes: 7

Related Questions