Zend Framework

Lighttpd rewrite rule

Details

  • Type: Docs:  Problem Docs: Problem
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.0
  • Fix Version/s: 1.5.2
  • Component/s: None
  • Labels:
    None
  • Language:
    English

Description

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

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):

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

Regards

Jean-Yves

Activity

Hide
Darby Felton added a comment -

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:

http://example.com/?style=my.css
http://example.com/index/?a=1&which=nice.gif

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

Show
Darby Felton added a comment - 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:
http://example.com/?style=my.css
http://example.com/index/?a=1&which=nice.gif
would match the first rule and fail. Perhaps these are edge cases, however.
Hide
Jean-Yves Pellé added a comment -

You are absolutely right Darby

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

url.rewrite-once = (
  ".*\?(.*)$" => "/index.php?$1",
  ".*\.(js|ico|gif|jpg|png|css)$" => "$0",
  "" => "/index.php"
)
Show
Jean-Yves Pellé added a comment - You are absolutely right Darby I may have a solution, you just have to swap two lines:
url.rewrite-once = (
  ".*\?(.*)$" => "/index.php?$1",
  ".*\.(js|ico|gif|jpg|png|css)$" => "$0",
  "" => "/index.php"
)
Hide
Wil Sinclair added a comment -

Please categorize/fix as needed.

Show
Wil Sinclair added a comment - Please categorize/fix as needed.
Hide
Darby Felton added a comment -

Fixed with SVN r9420.

Show
Darby Felton added a comment - Fixed with SVN r9420.
Hide
Wil Sinclair added a comment -

Changing to comply with new IT coventions for components.

Show
Wil Sinclair added a comment - Changing to comply with new IT coventions for components.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
15m
Original Estimate - 15 minutes
Remaining:
15m
Remaining Estimate - 15 minutes
Logged:
Not Specified
Time Spent - Not Specified