Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|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

1 Answer 1

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.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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