在lighttpd中包含许多重写指令
我在并行子目录中有很多项目,它们都有 etc/lighttpd.conf 文件。 文件非常简单; 它们只包含一个如下所示的指令:
url.rewrite-once = ("^/project(.*)$"=>"project/router.php?args=$1")
不幸的是,我刚刚发现我不能简单地循环它们,因为我会收到“重复的配置变量”错误。 我发现我应该使用它的方式是这样的:
url.rewrite-once = (
"^/project1(.*)$"=>"project1/router.php?args=$1"
,"^/project2(.*)$"=>"project2/router.php?args=$1"
)
但是,如果我让每个目录的配置文件只包含重写,并让 shell 脚本构建它们,我就不能真正放置任何其他轻量级指令在每个目录文件中。 话又说回来,我是 Lighty 的新手,所以也许我不需要而且只是没有意识到这一点。
这样做的“正确方法”是什么?
I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files. The files are very simple; they just include a directive that looks like this:
url.rewrite-once = ("^/project(.*)$"=>"project/router.php?args=$1")
Unfortunately, I just discovered that I can't simply loop through them, because I'll get a "duplicate config variable" error. I see that the way I'm supposed to use it is like this:
url.rewrite-once = (
"^/project1(.*)$"=>"project1/router.php?args=$1"
,"^/project2(.*)$"=>"project2/router.php?args=$1"
)
However, if I make my per-directory config files just include the rewrites, and have a shell script build them, I can't really put any OTHER lighty directives in the per-directory files. Then again, I'm new to lighty, so maybe I don't need to and just don't realize it.
What's "the right way" to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试:
将新配置附加到现有变量,而不是再次定义它。
try:
to append your new config to the existing variable instead of defining it again.