logo       

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

web.lighttpd

Subject: Re: Feature Request: Flexible Rewrite Rules

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?

Steffen




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

News | FAQ | advertise