URL rewrite in lighttpd

南笙酒味 提交于 2019-12-13 02:18:36

问题


I have the following query:

update234ae5.php?q=1&q=2....

must be rewritten to:

update.php?cond=234ae5&q=1&q=2....

I use:

"^/update(([a-zA-Z0-9]+))"  =>  "/update.php?cond=$1"

How can I add the rest of url string, because my url is rewritten to

update.php?cond=234ae5& 

without the rest of params

In Apache I use

RewriteCond %{QUERY_STRING} (.*)  
RewriteRule ^/update([0-9a-z]+).php /update.php?cond=$1&%1

回答1:


As the lighttpd documentation states:

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"


来源:https://stackoverflow.com/questions/3902394/url-rewrite-in-lighttpd

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!