Lighttpd url重写删除查询字符串变量

时间:2009-09-20 17:31:03

标签: url-rewriting lighttpd

我正在使用

重写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规则的第一部分是确保正确显示存在的文件)

1 个答案:

答案 0 :(得分:3)

尝试这样的事情:

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

或者

    "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
  "^/([^.?]*)$" => "/index.php?q=$1"
相关问题