在lighttpd的apache的.htaccess文件文件、lighttpd、apache、htaccess

2023-09-02 09:45:45 作者:灼灼桃花仙

RewriteEngine on
RewriteRule ^packed.js$ pack.php?debug=0 [nc]
RewriteRule ^debug$ pack.php?debug=1 [nc]

在放置在一个特定的目录中的.htaccess文件工作的罚款在Apache。如果我想这样做的lighttpd的,我必须把它添加在配置文件什么的?

That worked fine on apache in a .htaccess file placed in a specific directory. If I want to do this on lighttpd, do I have to add it in the config file or something?

,我需要做任何改变这些规则?

Would I need to make any changes to these rules?

推荐答案

的lighttpd不支持的.htaccess 文件像Apache httpd的一样。这就是在lighttpd的光来发挥作用。

lighttpd doesn't support .htaccess files like Apache httpd does. That's where the "light" in "lighttpd" comes into play.

您可以,但是,来自Apache httpd的的 mod_rewrite的这些规则迁移到lighttpd的的 mod_rewrite的。但要知道,在 NC 标志(不区分大小写匹配)是的没有的通过的lighttpd的mod_rewrite支持。如果你是罚款,没有它,你可以简单地使用下面的重写规则:

You can, however, migrate these rules from Apache httpd's mod_rewrite to lighttpd's mod_rewrite. But be aware that the NC flag (case-insensitive matching) is not supported by lighttpd's mod_rewrite. If you are fine without it, you could simply use the following rewrite rules:

url.rewrite-once = (
    "^packed.js$"  => "pack.php?debug=0",
    "^debug$" => "pack.php?debug=1" 
)

如果您需要匹配是不区分大小写的,你可能需要调用 mod_magnet 和一个自定义的Lua脚本。

If you need the match to be case-insensitive, you'll probably need to invoke mod_magnet and a custom Lua script.