Many people recommend that you use the following code in .htaccess for GZip:
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/ht开发者_运维技巧ml
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
Why does Firefox 4 need an exception? Or am I misunderstanding the code?
Mozilla/4
!= Firefox 4
In fact, Firefox 4 uses Mozilla/5
as part of its user-agent. For historical compatibility reasons (see this), most (all?) web browsers identify themselves as Mozilla (other tokens in the user agent can be used to tell Safari from Firefox from IE, etc)
"Mozilla/4" would match things like Netscape 4 and IE 8 or earlier. It doesn't match any modern web browser (IE9, all Gecko-based browsers, Safari, and Chrome all use "Mozilla/5" while Opera uses no "Mozilla/something" token at all).
精彩评论