lighttpd 上的 apache .htaccess 文件

发布于 2024-09-18 03:52:24 字数 245 浏览 0 评论 0原文

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

这在放置在特定目录中的 .htaccess 文件中的 apache 上运行良好。如果我想在lighttpd上执行此操作,我是否必须将其添加到配置文件或其他内容中?

我需要对这些规则进行任何更改吗?

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

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?

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

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

发布评论

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

评论(1

樱花坊 2024-09-25 03:52:24

lighttpd 不像 Apache httpd 那样支持 .htaccess 文件。这就是“lighttpd”中的“光”发挥作用的地方。

但是,您可以将这些规则从 Apache httpd 的 mod_rewrite 迁移到 lighttpd 的 < a href="http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite" rel="noreferrer">mod_rewrite。但请注意,lighttpd 的 mod_rewrite支持 NC 标志(不区分大小写的匹配)。如果没有它,您可以简单地使用以下重写规则:

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

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

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

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

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

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