mod_deflate来破坏我的网站?

时间:2015-11-22 20:56:47

标签: .htaccess

我有这个代码示例用deflate来破坏我的网站:

//wrapping the casts
const example_impl& castToImpl(const unsigned char* mem) { return *reinterpret_cast<const example_impl*>(mem);  }
      example_impl& castToImpl(      unsigned char* mem) { return *reinterpret_cast<      example_impl*>(mem);  }


example& example::operator=(const example& other)
{
    castToImpl(this->state) = castToImpl(other.state);
    return *this;
}

example& example::operator=(example&& other)
{
    castToImpl(this->state) = std::move(castToImpl(other.state));
    return *this;
}

但我在提供商网站上看到我还要插入此规则:  1 - ** mod_gzip_on是吗?**这个规则是必须的还是我必须忽略它?上面的代码就足够了。

我的第二个问题是:我在下面阅读了这个建议!!

某些流行的浏览器无法处理所有内容的压缩,因此您可能需要将gzip-only-text / html注释设置为1以仅允许压缩html文件。如果将此值设置为1,则会被忽略。

我理解他们不支持妥协的某些浏览器,我是否应该在此处插入以下规则:

 <ifModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/plain
 AddOutputFilterByType DEFLATE text/html
 AddOutputFilterByType DEFLATE text/xml
 AddOutputFilterByType DEFLATE text/css
 AddOutputFilterByType DEFLATE application/xml
 AddOutputFilterByType DEFLATE application/xhtml+xml
 AddOutputFilterByType DEFLATE application/rss+xml
 AddOutputFilterByType DEFLATE application/javascript
 AddOutputFilterByType DEFLATE application/x-javascript
 AddOutputFilterByType DEFLATE application/json
 </ifModule>

或者只是忽略它?

1 个答案:

答案 0 :(得分:1)

我不明白你的第一个问题但如果是关于在mod_gzip上使用mod_deflate那么答案是使用mod_deflate。开发在mod_gzip上停止了几年前,mod_deflate是标准Apache的一部分,并且(尽管它的名字)使用gzip - 虽然如果你愿意也可以使用不太广泛支持的deflate选项,但不建议这样做。

关于你不再需要的第二个问题。一些非常非常非常古老的浏览器中存在用于gzip的错误,但现在所有浏览器都能很好地处理它并告诉Apache它们是否存在错误。这些旧浏览器都不再使用,即使它们可能因其他原因无法打开您的网站。有关gzip浏览器支持,请参阅此处:http://schroepl.net/projekte/mod_gzip/browser.htm