lighthttp 的 mod_rewrite 问题

发布于 2024-08-05 08:40:35 字数 837 浏览 1 评论 0原文

我正在将 mod_rewrite 与 lighttpd 一起使用,并且遇到了问题...

这是我的规则:

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

apa​​che 规则适用于 apache,看起来像这样:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

它工作得很好,除了当我想使用 phpmyadmin 时, http://www.site.com/phpmyadmin 当然会被重定向到我告诉它的地方......但是,我真的希望它能够处理真实的目录和文件。

如何更改 lighttpd 中的重写规则以尊重 /phpmyadmin 等内容?

编辑:

查看所有内容并进行一些研究,我缺少这些行的lighttpd 等效项:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d  

How can I add those to thelighttpd rewrite config?

I am using mod_rewrite with lighttpd, and I am having an issue...

Here is my rule:

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

The apache rule works on apache, and looks like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d   
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

It works perfectly, except, when I want to use phpmyadmin, http://www.site.com/phpmyadmin is of course being redirected to where I am telling it to... however, I would really like it to work with real directories and files.

How can I change the rewrite rule in lighttpd to respect things such as /phpmyadmin?

Edit:

Looking over everything and doing some research, I am missing the lighttpd equivilent of these lines:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d  

How can I add these to the lighttpd rewrite config?

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

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

发布评论

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

评论(1

猫腻 2024-08-12 08:40:35

经过大量的折腾、阅读和许多其他艰苦的事情之后,我想出了这个,我希望它能帮助其他人解决我遇到的同样的问题......

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

所以:
http://www.site.com/class/method/test/ 1/test2/2(将按预期工作)
http://www.site.com/phpmyadmin/ (将按预期工作 - 注意尾部斜杠)

After a lot of messing around, reading, and many other painstaking things, I came up with this, and I hope it helps everyone else with the same problem I had...

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

So:
http://www.site.com/class/method/test/1/test2/2 (WILL WORK AS EXPECTED)
http://www.site.com/phpmyadmin/ (WILL WORK AS EXPECTED - note trailing slash)

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