在lighttpd中重写URL [英] URL rewrite in lighttpd
本文介绍了在lighttpd中重写URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下查询:
update234ae5.php?q=1&q=2....
必须重写为:
update.php?cond=234ae5&q=1&q=2....
我使用:
"^/update(([a-zA-Z0-9]+))" => "/update.php?cond=$1"
如何添加其余的url字符串,因为我的url被重写为
How can I add the rest of url string, because my url is rewritten to
update.php?cond=234ae5&
没有其他参数
在Apache中,我使用
In Apache I use
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^/update([0-9a-z]+).php /update.php?cond=$1&%1
推荐答案
作为 lighttpd文档状态:
如果您想传递查询字符串 (?foo = bar)到重写目标 您必须明确匹配它:
If you wanna pass the Query String (?foo=bar) to the rewrite destination you have to explicitly match it:
因此,您将需要以下内容:
So you'll want something like:
"^/update([a-zA-Z0-9]+)\.php(\?(.+))?" => "/update.php?cond=$1&$3"
这篇关于在lighttpd中重写URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文