URL rewrite in lighttpd

2019-08-13 15:09发布

问题:

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"


标签: lighttpd