您的位置:首页 > 运维架构 > Apache

apache AddOutputFilter html 支持Include

2016-04-06 11:43 429 查看
AddOutputFilter 就是针对某一种特定后缀的文件,添加一个处理程序(管道或者拦截器)

今天配置了mac 的 include

按照如下配置设置了Apache 的 SSI 功能

确认加载include.so模块,将注释去掉:

LoadModule include_module libexec/apache2/mod_include.so

AddType部分去掉这两段注释:

AddType text/html .shtml

AddOutputFilter INCLUDES .shtml

Directory目录权限里面找到

Options Indexes FollowSymLinks

增加Includes修改为:

Options Indexes FollowSymLinks Includes

重新启动Apache,测试:

但是发现没有生效,查找原因发现我的代码使用的主页面和子页面都是 html 后缀,但是文档中配置的是 .shtml 后缀,修改后配置文件为:

AddType text/html .html

AddOutputFilter INCLUDES .html


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


测试没有问题

参考文档:

https://httpd.apache.org/docs/current/mod/mod_mime.html#addoutputfilter

http://www.jb51.net/article/26438.htm
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: