Web Hosting Talk







View Full Version : Rewrite Rules problems, can anybody help?


The Chief
04-21-2006, 02:31 AM
Hey all,

I am currently in the process of moving over to lighttpd instead of Apache and I am having some problems with my rewrite rules.

I am using this rule for drupal:

url.rewrite-final = (
"^/system/test/(.*)$" => "/index.php?q=system/test/$1",
"^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
"^/([^.?]*)$" => "/index.php?q=$1",
)

and I have a hack that redirects my forum users to a url like this:

http://www.whatever.com/forums/member.php?u=234 to http://www.whatever.com/forums/Chris

and I have tried many different rules such as:

"^/forums/([^.?]*)" => "/forums/member.php?username=$1"


And this does work by redirecting /forums/Username to /forums/member.php?u=username but no matter how many different rules or things i try, i cannot figure out how to get a rule to redirect /forums/Username to that url without it interfering with loading your forum (index.php page and other things)

can anybody help out?

The Chief
04-22-2006, 05:43 PM
would anybody be able to help?

Burhan
04-23-2006, 02:25 AM
I don't know what all is available to you in lighttpd; but in Apache you can add a condition that the rule only be applied if the requested item does not alread exist in the directory. Its a -f RewriteCondition, but I can't remember the exact syntax of it right now. You need the equivalent.

The Chief
04-24-2006, 10:21 AM
I don't know what all is available to you in lighttpd; but in Apache you can add a condition that the rule only be applied if the requested item does not alread exist in the directory. Its a -f RewriteCondition, but I can't remember the exact syntax of it right now. You need the equivalent.
Yeah, we got it to work with Apache, but with lighttpd, it's different.