【问题标题】:Lighttpd url rewrite removes querystring variablesLighttpd url rewrite 删除查询字符串变量
【发布时间】:2010-10-08 15:36:05
【问题描述】:

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

【问题讨论】:

    标签: url-rewriting lighttpd


    【解决方案1】:

    试试这样的:

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

    或者这个

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

    【讨论】:

    • 我有一个临时修复,所以我有点想不要修复没有损坏的东西,但我会尝试按照你的建议正确地做事并报告
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-20
    • 2011-02-02
    • 1970-01-01
    • 1970-01-01
    • 2011-07-28
    相关资源
    最近更新 更多