Lighttpd 重写 Codeigniter 在某些 URL 上崩溃

发布于 2025-01-05 12:15:40 字数 819 浏览 2 评论 0原文

我从 apache 迁移到 lighttpd,从那时起,某些 URL 破坏了重写并给出 404。access.log、error.log 中没有关于实际命中的 URL 的详细信息。

这些工作: http://192.168.1.250/loop/rest/admin

但不是这些: http://192.168.1.250/loop/ rest/admin/logs/file::log-2012-02-14.php

如果我跳过重写并使用 http://192.168 .1.250/loop/rest/index.php?/admin/logs/file::log-2012-02-14.php

我得到了我想要的,

在这里是我的重写规则:

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

任何帮助将不胜感激。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

伏妖词 2025-01-12 12:15:40

我在 lighttpd 上测试我的 codeigniter 应用程序时遇到了同样的问题

这对我有用:

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

也许你可以尝试这个设置:

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

确保你在顶部有未注释的 mod_rewrite ..它默认在前面有一个 # 。

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.

深府石板幽径 2025-01-12 12:15:40

我找到了正确的规则:

首先请确保您的根指令指向您的 CI 设置的根目录。

root /var/www/loop;

那么这个位置指令就可以完美地工作:

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

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;
    }
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文