views:

487

answers:

1

I am rewriting a URL in Lighttpd using

url.rewrite-once = (
"^/(.*)\.(.+)$" => "$0",
"^/(.+/?)\??$" => "/index.php?q=$1"
)

So that all urls are passed to index.php as variable q. However when I visit http://mydomain.com/account/edit?user=5 my script at index.php gets

q=account/edit?user=5

on apache I would get all variables i.e.

q=account/edit   AND
user=5

How can I preserve the variables in Lighttpd?

(the first part of the url.rewrite rule is to ensure that files that exist are displayed properly)

A: 

Try something like this:

  "^/something/(\d+)(?:\?(.*))?" => "/index.php?bla=$1&$2"

or this

    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
  "^/([^.?]*)$" => "/index.php?q=$1"
Shtirlic
I've got a temporary fix in place so I'm kind of thinking don't fix what isn't broken, but I'll try and do things properly with your suggestion and report back
James