0

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)

James
  • 1,397
  • 3
  • 21
  • 30

1 Answers1

4

Try something like this:

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

or this

    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
  "^/([^.?]*)$" => "/index.php?q=$1"
Shtirlic
  • 692
  • 1
  • 6
  • 14
  • 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 Sep 30 '09 at 23:53