2

I moved from apache to lighttpd, and since then certain URLs break the rewriting and give 404. No details in access.log, error.log regarding what actual URL was hit.

These kind work: http://192.168.1.250/loop/rest/admin

But not these: http://192.168.1.250/loop/rest/admin/logs/file::log-2012-02-14.php

If I skip rewriting and use http://192.168.1.250/loop/rest/index.php?/admin/logs/file::log-2012-02-14.php

I get what I want,

Here is my rewrite rule:

url.rewrite-once = (
 "/(.*)\.(.*)" => "$0",
 "/(css|files|img|js|stats)/" => "$0",
 "^/([^.]+)$" => "/loop/rest/index.php/$1"
)

Any help would be appreciated.

2 Answers 2

4

I was just having the same issues when testing my codeigniter app on lighttpd

This worked for me:

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

maybe you could try this for your setup:

 url.rewrite = (
          ".*\.(js|ico|gif|jpg|png|swf|css|html)$" => "$0",
          "^/(.*)$" => "/loop/rest/index.php/$1"
     )

Make sure you have uncommented mod_rewrite at the top.. it comes default with a # in front of it.

1
  • Thanks for your input, I however found a much simpler rule that works :) Mar 7, 2012 at 1:29
0

I have found the correct rules:

First of all please make sure that your root directive points to the root of your CI setupd.

root /var/www/loop;

Then this location directive will work perfectly fine:

location /
  {
    if (!-e $request_filename)
    {
      rewrite ^/(.*)$ /index.php?/$1 last;
      break;
    }
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.