确认加载include.so模块,将注释去掉:
LoadModule include_module libexec/apache2/mod_include.so 2. AddType部分去掉这两段注释: AddType text/html .shtml AddOutputFilter INCLUDES .shtml 3. Directory目录权限里面找到 Options Indexes FollowSymLinks 增加Includes修改为: Options Indexes FollowSymLinks Includes 4. 重新启动Apache,测试: <!–#include file=”head.html”–> Holle Word!,这是中间的内容 <!–#include file=”foot.html”–> 以下是其它网友的补充: 什么是SSI? SSI是英文Server Side Includes的缩写,翻译成中文就是服务器端包含的意思。从技术角度上说,SSI就是在HTML文件中,可以通过注释行调用的命令或指针。SSI具有强大的功能,只要使用一条简单的SSI命令就可以实现整个网站的内容更新,时间和日期的动态显示,以及执行shell和CGI脚本程序等复杂的功能。 如何使你的Apache服务器支持SSI? Apache默认是不支持SSI的,需要我们更改httpd.conf来进行配置。我这里以windows平台的Apache 2.0.x为例,打开conf目录下的httpd.conf文件,搜索“AddType text/html .shtml”,搜索结果:
代码如下:
# AddType text/html .shtml # AddOutputFilter INCLUDES .shtml 把这两行前面的#去掉。 然后搜索“Options Indexes FollowSymLinks” 在搜索到的那一行后面添加“ Includes” 即将该行改变为 Options Indexes FollowSymLinks Includes 保存httpd.conf,重起apache即可。 到此我们就完成了对Apache SSI的设置。