.htaccess:FilterProvider 问题

Posted

技术标签:

【中文标题】.htaccess:FilterProvider 问题【英文标题】:.htaccess: FilterProvider issue 【发布时间】:2015-10-09 08:30:07 【问题描述】:

这可能真的很简单,但是我的编码员正在度假并且没有通讯,而且我是一名图形设计师,具有相当基本的 html 和 CSS 知识。这超出了我的范围。

我们的一个客户网站遇到了这个问题:

.htaccess: FilterProvider 接受三个参数,filter-name 提供者名称匹配表达式

我认为它与 .htaccess 文件的这一部分有关,但如果我知道答案是什么,我该死的:

# 对损坏的标头强制放气 developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X15|~15|-15)$ ^((gzip|deflate)\s*,?\s*)+|[X~-]4,13$ HAVE_Accept-Encoding RequestHeader 附加 Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding # HTML、TXT、CSS、javascript、JSON、XML、HTC: 过滤器声明压缩 FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype FilterChain 压缩 FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no # 旧版 Apache AddOutputFilterByType DEFLATE text/html text/plain text/css application/json AddOutputFilterByType DEFLATE 应用程序/javascript AddOutputFilterByType DEFLATE text/xml application/xml text/x-component AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype


如果有人能帮忙,我将非常感激!

【问题讨论】:

如果您可以发布带有换行符的 .htaccess 文件,那将非常容易提供帮助 ***.com/questions/22475131/… 的重复项? 格式化排序。谢谢你的链接,Jaromanda X,但老实说,我不知道这意味着什么:( 啊哈!粘贴到新代码中,现在一切正常! 【参考方案1】:

替换

FilterDeclare COMPRESS
...
...
...
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no 

FilterDeclare   COMPRESS
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'text/html'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'text/css'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'text/plain'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'text/xml'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'text/x-component'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/javascript'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/json'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/xml'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/xhtml+xml'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/rss+xml'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/atom+xml'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/vnd.ms-fontobject'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'image/svg+xml'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'image/x-icon'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'application/x-font-ttf'"
FilterProvider  COMPRESS  DEFLATE "%Content_Type = 'font/opentype'"
FilterChain     COMPRESS
FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no

【讨论】:

遇到了完全相同的问题,这就像一个魅力!谢谢! 未来的读者——我在将站点从 apache 2.2 移动到 apache 2.4 时遇到了这个错误,这种格式的改变起到了作用。如果你好奇。原因如下:httpd.apache.org/docs/2.4/mod/mod_filter.html#upgrade

以上是关于.htaccess:FilterProvider 问题的主要内容,如果未能解决你的问题,请参考以下文章

java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.FilterProvider 在 flink 启动时

如何全局设置 ValidateAntiForgeryToken

浅谈.htaccess文件--避免滥用.htaccess文件

apache开启.htaccess及.htaccess的使用方法

.htaccess 这个网页有一个重定向循环 htaccess

apache开启.htaccess及.htaccess的使用方法