如何服务器端包括?

时间:2013-10-12 06:02:23

标签: indexing include

我希望服务器端包含在我的网页中,我有index.html& header.html,如何将标头文件包含在html文件中?

代码如下所示,但是&我需要在哪里实现它?

<!--#include virtual="presets/header.html" -->

获得更好的信息here is my website

1 个答案:

答案 0 :(得分:0)

似乎你有一个mac osx服务器(无法查看哪个版本,因此我的信息可能不准确)。

如评论中所述,您必须允许包含所有内容。由于你有一个apache(默认在mac osx上)你应该遵循以下信息:

http://httpd.apache.org/docs/2.2/howto/ssi.html

在我的osx lion服务器上,配置文件位于:

/etc/apache2/httpd.conf

所以在gereral:

  • 停止apache
  • 编辑配置文件
  • 添加您在问题中显示的包含代码(可能)之前(取决于您的header.html的内容)索引中的“body”标记。(s)html文件
  • 重新启动apache

如果要在所有文件中启用SSI,可以将上述ssi howto中的建议更改为:

AddOutputFilter INCLUDES .html

甚至

AddOutputFilter INCLUDES .htm