Issues

ZF-2901: Lighttpd rewrite rule

Issue Type: Docs: Problem Created: 2008-03-17T14:57:00.000+0000 Last Updated: 2008-06-15T20:40:17.000+0000 Status: Resolved Fix version(s): - 1.5.2 (15/May/08)

Reporter: Jean-Yves Pellé (djiwhy) Assignee: Darby Felton (darby) Tags: Related issues: Attachments:

Description

In the Programmer's Reference Guide (Section 7.5.1.), about the lighttpd rewrite rule there is:

<pre class="highlight">
url.rewrite-once = (
  ".*\.(js|ico|gif|jpg|png|css)$" => "$0",
  "" => "/index.php"
)

But with this rewrite rule you miss the HTTP GET parameters

I suggest this rule (tested with succes on my website):

<pre class="highlight">
url.rewrite-once = (
  ".*\.(js|ico|gif|jpg|png|css)$" => "$0",
  ".*\?(.*)$" => "/index.php?$1",
  "" => "/index.php"
)

Regards

Jean-Yves

Comments

Posted by Darby Felton (darby) on 2008-03-20T15:32:20.000+0000

It looks like both rulesets would be susceptible to breaking when GET parameters end in the same suffixes as listed in the first rule of each ruleset. For example, URLs such as:

<pre class="literal">
<a href="http://example.com/?style=my.css">http://example.com/?style=my.css</a>
<a href="http://example.com/index/?a=1&which=nice.gif">http://example.com/index/?a=1&which=nice.gif</a>

would match the first rule and fail. Perhaps these are edge cases, however.

Posted by Jean-Yves Pellé (djiwhy) on 2008-03-20T17:47:56.000+0000

You are absolutely right Darby

I may have a solution, you just have to swap two lines:

<pre class="highlight">
url.rewrite-once = (
  ".*\?(.*)$" => "/index.php?$1",
  ".*\.(js|ico|gif|jpg|png|css)$" => "$0",
  "" => "/index.php"
)

Posted by Wil Sinclair (wil) on 2008-03-25T21:09:52.000+0000

Please categorize/fix as needed.

Posted by Darby Felton (darby) on 2008-05-08T10:22:52.000+0000

Fixed with SVN r9420.

Posted by Wil Sinclair (wil) on 2008-06-15T20:40:17.000+0000

Changing to comply with new IT coventions for components.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts