deflate php,我可以告诉mod_deflate和PHP只跳过一个目录上的压缩吗?

要压缩我的所有网页,我使用这个.htaccess代码.如果可能,它使用Apache deflate模块,否则应用

PHP ob_gzhandler压缩.

一切正常,但由于特定原因,我不想对文件夹./folderWithoutCompression应用压缩.

问题:如果在下面的脚本中定义了Apache deflate模块(PHP ob_gzhandler case),我该如何添加此异常?

# force deflate for mangled headers

# developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/

SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$HAVE_Accept-Encoding

RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:

FilterDeclare COMPRESS

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 $application/x-font-ttf

FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype

FilterChain COMPRESS

FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

# Legacy versions of Apache

AddOutputFilterByType DEFLATE text/html text/plain text/css application/json

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE text/xml application/xml text/x-component

AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml

AddOutputFilterByType DEFLATE application/atom+xml

AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject

AddOutputFilterByType DEFLATE application/x-font-ttf font/opentype

#Apache deflate module is not defined, active the page compression through PHP ob_gzhandler

php_flag output_buffering On

php_value output_handler ob_gzhandler

编辑

解决方法是,我对folderWithoutCompression文件夹中的所有文件使用自定义内容类型.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值