本文介绍了使用Apache mod_rewrite禁用IE pre SP2的压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试复制此修复程序()与Apache mod_rewrite,但没有成功...有人可以帮助我翻译这些ISAPI规则到APACHE mod_rewrite?我不知道如何翻译这些规则...



我的目标是避免发送压缩的css和js,当用户有SP2之前的XP版本,因为有一个错误,阻止IE6& 7在SP1下读取我的网站BuscoUnViaje.com的gzip压缩的CSS



我试图翻译到Apache的规则mod_rewrite:

  RewriteCond%{HTTP:User-Agent} MSIE\ [56] 
RewriteCond%{HTTP: User-Agent}!SV1
RewriteCond%{REQUEST_URI} \。(css | js)$
RewriteHeader接受编码:。* $ 1
解决方案

mod_rewrite没有RewriteHeader指令,所以我与mod_headers结合使用它来实现所需的结果:

  RewriteEngine on 

< IfModule mod_headers.c>
RewriteCond%{HTTP_USER_AGENT} MSIE\ [56]
RewriteCond%{HTTP_USER_AGENT}!SV1
RewriteCond%{REQUEST_URI} \。(css | js)$
RewriteRule。 * - [E = REMOVE_IE_ACCEPT_ENCODING:1]

< LocationMatch \。(css | js)$&
RequestHeader set Accept-Encodingenv = REMOVE_IE_ACCEPT_ENCODING
< / LocationMatch>
< / IfModule>

希望它有帮助!


I am trying to replicate this fix ( http://sebduggan.com/posts/ie6-gzip-bug-solved-using-isapi-rewrite ) with Apache mod_rewrite, but with no success... Can somebody help me translate those ISAPI rules to APACHE mod_rewrite? I don't know how to 'translate' those rules...

My objective is to avoid sending compressed css and js when the user has an XP version prior to SP2, since there is a bug that prevents IE6&7 under SP1 to read the gzipped CSSs of my website BuscoUnViaje.com

The rules I am trying to 'translate' to Apache mod_rewrite:

RewriteCond %{HTTP:User-Agent} MSIE\ [56]
RewriteCond %{HTTP:User-Agent} !SV1
RewriteCond %{REQUEST_URI} \.(css|js)$
RewriteHeader Accept-Encoding: .* $1

Thanks in advance...

解决方案

mod_rewrite has no RewriteHeader directive, so I used it in conjunction with mod_headers to achieve the desired result:

RewriteEngine on

<IfModule mod_headers.c>
  RewriteCond %{HTTP_USER_AGENT} MSIE\ [56]
  RewriteCond %{HTTP_USER_AGENT} !SV1
  RewriteCond %{REQUEST_URI} \.(css|js)$
  RewriteRule .* - [E=REMOVE_IE_ACCEPT_ENCODING:1]

  <LocationMatch \.(css|js)$>
    RequestHeader set Accept-Encoding "" env=REMOVE_IE_ACCEPT_ENCODING
  </LocationMatch>
</IfModule>

Hope it helps!

这篇关于使用Apache mod_rewrite禁用IE pre SP2的压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 06:27