mod_substitute 和 mod_sed 都没有替换 Apache 中的任何内容

nat*_*iah 2 apache-2.2 apache-2.4

我在Ubuntu 14.04运行的Apache 2.4.7和我都mod_sedmod_substitute安装,并通过启用a2enmod。我正在尝试获得基本的输出替换,但没有得到任何结果。我在 Windows(Apache 2.4 和 Apache 2.2)上运行了这个替代品,没有任何问题,但我无法在 Ubuntu 上获得任何组合。这是我正在使用的:

<Location />
        AddOutputFilter Sed html
        AddOutputFilter SUBSTITUTE html
        AddOutputFilter Sed text/html
        AddOutputFilter SUBSTITUTE text/html
        AddOutputFilterByType Sed text/html
        AddOutputFilterByType SUBSTITUTE text/html
        OutputSed "s/harvest/HRRVST/g"
        Substitute "s/harvest/HRRVST/"
</Location>
Run Code Online (Sandbox Code Playgroud)

我已经包括了我单独和一次性尝试过的所有不同的输出过滤器。我已经在主要apache2.conf和块中尝试过这个VirtualHost块。我在两个地方都尝试过DirectoryLocation块。我已确认正在处理该文件并且我正在浏览器中访问正确的服务器。

我需要做些什么才能使这项工作发挥作用?

小智 8

如果你需要这两个模块mod_deflatemod_substitute你可以添加

SetOutputFilter SUBSTITUTE;DEFLATE
Run Code Online (Sandbox Code Playgroud)

到您的<Location>...</Location>和过滤器将按此顺序使用。