logo       

Re: Feature Request: Flexible Rewrite Rules: msg#00072

web.lighttpd

Subject: Re: Feature Request: Flexible Rewrite Rules

On Sat, Sep 18, 2004 at 08:37:36PM +0200, Steffen Weber wrote:
> Am Freitag, 17. September 2004 22:26 schrieb Jan Kneschke:
> > Use 1.3.0 and url.rewrite-final.
>
> I?m trying to achieve the following:
> - Let all requests to images, stylesheets, javascript an text files go through
> - Let all requests to the directories "forum" and "stuff" go through
> - Rewrite all other requests to /index.php
>
> Well, I?ve not been successful. I?ve created the following rewrite rules:
>
> url.rewrite-final = ( "^.*\.(jpg|gif|css|js|txt})$" )
> url.rewrite-final = ( "^forum.*" => "/forum/" )
> url.rewrite-final = ( "^stuff.*" => "/stuff/" )
> url.rewrite-final = ( "^.*$" => "/index.php" )
>
> If I then request "/somedir/" I get a 404 error, although it should have been
> rewritten to index.php by the last rule, which should match everything that
> has not been matched before?!
>
> If I change the last line to
>
> url.rewrite = ( "^.*$" => "/index.php" )
>
> this redirect rule seems to become recursive as my browser never gets a
> response and I have to "kill -kill <lighttpd pid>" in order to stop the
> server.
>
> If I change the last line to
>
> url.rewrite = ( "^.*/$" => "/index.php" )
>
> in order to only match requests with a slash in the end requests to
> "/somedir/" are correctly rewritten to index.php. But then strangely requests
> to "/forum/" and "/stuff/" are also rewritten to index.php, although I think
> they should not be as I?m using rewrite-final to exclude requests to
> "/forum/" from any further redirect rules.
>
> Could someone please enlighten me?
>
> The only possible explanation which comes to my mind is that after having
> passed the rewrite-chain the rewritten URL is again passed through the
> rewrite chain. If this is the case, how can I disable this behaviour?

It should work exactly that way. I'll check why it doesn't.

> Steffen
>
Jan

--
Jan Kneschke http://jan.kneschke.de/
Perhaps you want to say 'thank you, jan': http://jk.123.org/wishlist/




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise