Justin
Justin

Reputation: 45400

Lighttpd Rewrite Rule (match not having a period)

I am trying to figure out a rewrite rule for lighttpd that will behave in the following way:

If the uri (the part after the protocol and domain) does not contain a period execute the rule.

Examples:

uri = "/people/add"
Should run the rule.

uri = "/js/main.js"
Should NOT run the rule.

uri = "/people.php"
Should NOT run the rule.

Here is what I have so far, but it does not behave as expected, it always runs the rule:

$HTTP["host"] =~ "^(my\.domain\.com)$" {
    url.rewrite-once = (
            "^/(.*)$" => "index.php/$1"
    )
}

Upvotes: 0

Views: 141

Answers (1)

Lone Shepherd
Lone Shepherd

Reputation: 1005

Maybe try the following for your regex? I'm not familiar with the syntax lighthttpd supports, but if it supports character classes, below should do what you are asking.

 "^/([^.]+)$"

Upvotes: 1

Related Questions