Apache:SSI 中的 SSI
有没有办法可以将包含文件包含在包含文件中? (快说五倍!)
例如:
index.html 内部:
<!--#include virtual="/include-1.shtml"-->
include1.shtml 内部:
<!--#include virtual="/include-2.shtml"-->
所以树看起来像这样: index.html < -- include_1.shtml <-- include_2.shtml
事实上,这在我的 Apache 上不起作用。 第一个包含工作正常,但嵌套包含的内容不显示。
相关的是,我在 Apache 2 上使用 XBitHack,并且我已经仔细检查了这两个文件是否可由 Web 用户执行。
帮助?
Is there a way I can include include files inside include files? (Say that five times fast!)
For example:
Inside index.html:
<!--#include virtual="/include-1.shtml"-->
Inside include1.shtml:
<!--#include virtual="/include-2.shtml"-->
So the tree looks like this: index.html <-- include_1.shtml <-- include_2.shtml
As is, this is not working on my Apache. The first include works fine, but the content for the nested include doesn't display.
As it is relevant, I am using the XBitHack on Apache 2, and I've double checked that both files are executable by the web user.
Help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保 Apache 实际上正在尝试处理 *.shtml 文件。 尝试放入
*.shtml 文件并查看是否获得预期结果。 您在 *.html 文件中得到相同的结果吗? 如果您在两者中都没有看到日期,则说明您的配置已关闭。
Make sure that Apache is actually trying to process the *.shtml files. Try putting
in a *.shtml file and seeing if you get the expected results. Do you get the same result in a *.html file? If you don't see the dates in both, your configuration is off.
我知道这个问题已有四年多了,但为了像我一样通过 StackOverflow 的令人惊叹的搜索引擎能力找到这个问题的人们的利益,我介绍了它的工作原理。
在 Apache2 下,您需要了解这一点 。
相关文字:
(强调我的)对我来说,解决方案在于取消默认
httpd.conf
中两行的注释:... 并将第一级包含文件的文件扩展名更改为 .shtml:
Boom! 嵌套 SSI 的工作方式就像冠军一样。
I know that this question is more than four years old, but for the benefit of people who, like me, find it thanks to StackOverflow's amazing search engine juice, here's how I made it work.
Under Apache2, you need to know this.
Relevant text:
(Emphasis mine) For me, the solution lay in uncommenting two lines in the default
httpd.conf
:… and changing the filename extension of the first-level included file to .shtml:
Boom! Nested SSI works like a champion.