apache AddOutputFilter html 支持Include

来源:互联网 发布:aso榜单优化 编辑:程序博客网 时间:2024/05/22 15:03

AddOutputFilter 就是针对某一种特定后缀的文件,添加一个处理程序(管道或者拦截器)

今天配置了mac 的 include
按照如下配置设置了Apache 的 SSI 功能

  1. 确认加载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,测试:

但是发现没有生效,查找原因发现我的代码使用的主页面和子页面都是 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

0 0