日期:2014-05-17  浏览次数:20611 次

让apache支持包含shtml,html,htm类型文件(非原创)

让apache支持包含shtml,html,htm类型文件(非原创)

?

ssi就是服务器端包含文件的意思。被包含的文件可以使用动态语言生成。

如何让Apache支持ssi呢?只要配置httpd.conf文件就可以了~~

Apache默认是不支持SSI的,需要我们更改httpd.conf来进行配置。打开conf目录下的httpd.conf文件,搜索“AddType text/html .shtml”,搜索结果:

AddType text/html .shtml .html .htm

AddOutputFilter INCLUDES .shtml .html .htm

把这两行前面的#去掉。

然后搜索“Options Indexes FollowSymLinks”
在搜索到的那一行后面添加“ Includes”
即将该行改变为 Options Indexes FollowSymLinks Includes
保存httpd.conf,重起apache即可。

使用

<!--#include? virtual="/xxx/header.shtml"-->

?