I have configured some lighttpd rewrites, of which one does not work. This is the line that does not work as it should and causes a white (blank) page to be thrown:

url.rewrite-once = (    
...
"^/search/([^\/]+)*/([^\/]+)*/([0-9]+)$" => "search.php?t=$1&k=$2&p=$3",
...
);

Also note that it is the only one with 3 parameters, all the rest in the section have 0-2. I found this error in the lighttpd error.log:

2011-01-07 17:13:09: (mod_rewrite.c.374) execution error while matching:  -8

Can someone help? Thanks.

link|improve this question
'([^\/]+)*' seems a bit strange to me: you have "one or more non-slash characters" which can be matched "0 or more times". I guess you want to remove the external '*', though that might not be your original problem. – lapo Jan 26 '11 at 10:49
feedback

1 Answer

Don't try to do too much in mod_rewrite. Looks like you're getting trying to enforce digits-only in the third parenthetical. Leave param validation inside the script.

I can vouch for the fact that a simple rewrite-once regex like this works on three params separated by slashes, as you seem to be aiming for:

"^/x50/(.*?)/(.*?)/(.*?)$" => "/script.php?b=$1&a=$2&f=$3&p=x50",

Let the regex matching work for you. Don't worry about slashes, just validate the params inside the script. (As you would have to do anyway.)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.