URL 重写缺少的 $_GET 参数
URL Rewrite missing $_GET parameters
我目前无法弄清楚为什么我的 url 重写没有保留请求(获取)参数。
这是一个示例 url:
http://localhost:8888/testwelt/allgemein?test=1234
这是我在 lighttpd.conf:
中重写的
url.rewrite-once = (
"^(/testwelt/(?!(favicon.ico$|sitemap.xml$|js/|pages/)).*)(\?|$)(.*)" => "/testwelt/index.php?url=&"
)
我的 $_GET
的 var_dump
揭示了这一点:
array(1) { ["url"]=> string(39) "/testwelt/allgemein?test=1234" }
说到url重写我不太适应。我究竟做错了什么?
谢谢!
我用这样的东西解决了我的问题:
url.rewrite-once = (
"^/testwelt/(sitemap.xml$|favicon\.ico$|php/|css/|js/).*" => "[=10=]",
"^/testwelt/([^?]*)(?:\?(.*))?" => "/testwelt/index.php?url=&"
)
小说明:
- 第一条规则 "prevents" 通过重定向到 URL 匹配重写特定 files/folders。
- 第二条规则匹配到“?”指示 url 参数的字符。然后它匹配 URL 参数并将它们添加到重写的 url.
我目前无法弄清楚为什么我的 url 重写没有保留请求(获取)参数。 这是一个示例 url:
http://localhost:8888/testwelt/allgemein?test=1234
这是我在 lighttpd.conf:
中重写的url.rewrite-once = (
"^(/testwelt/(?!(favicon.ico$|sitemap.xml$|js/|pages/)).*)(\?|$)(.*)" => "/testwelt/index.php?url=&"
)
我的 $_GET
的 var_dump
揭示了这一点:
array(1) { ["url"]=> string(39) "/testwelt/allgemein?test=1234" }
说到url重写我不太适应。我究竟做错了什么? 谢谢!
我用这样的东西解决了我的问题:
url.rewrite-once = (
"^/testwelt/(sitemap.xml$|favicon\.ico$|php/|css/|js/).*" => "[=10=]",
"^/testwelt/([^?]*)(?:\?(.*))?" => "/testwelt/index.php?url=&"
)
小说明:
- 第一条规则 "prevents" 通过重定向到 URL 匹配重写特定 files/folders。
- 第二条规则匹配到“?”指示 url 参数的字符。然后它匹配 URL 参数并将它们添加到重写的 url.