0

我正在使用 Lighttpd 重写 URL

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

这样所有的 url 都作为变量 q 传递给 index.php。但是,当我访问http://mydomain.com/account/edit?user=5我的 index.php 脚本时

q=account/edit?user=5

在apache上我会得到所有变量,即

q=account/edit   AND
user=5

如何保留 Lighttpd 中的变量?

(url.rewrite 规则的第一部分是确保存在的文件正确显示)

4

1 回答 1

4

尝试这样的事情:

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

或这个

    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
  "^/([^.?]*)$" => "/index.php?q=$1"
于 2009-09-30T22:48:08.730 回答