Search code examples
internet-explorer.htaccessdeflate

How do I specifically target internet explorer with htaccess deflate


This is closely related to anothewr question I have asked but since this is quite specific I thought it would be better asked seperately.

I have a very simple test site which consists of three files, index.html, all.js and .htaccess, here is my .htaccess:

# Compress some text file types
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript application/javascript application/json

This is the only thing I am doing to compress the files - I havent added any headers. Now I realise this has a lot of mime types I dont need but I think we have everything covered here. However for some reason files are only being compressed in firefox, not IE. Furthermore, if I look at the site through firefox and use user agent swither to switch to an IE user agent compression stops immediately.

I need this working in IE, My broader question is how do I make this happen but I am thinking it may be due to some Browser matching in the config so I am wondering how I can specifically target IE with deflate in htaccess.

Any help appreciated.


Solution

  • Have a look at your hosts config: grep -Ri BrowserMatch /etc/httpd /etc/apache2 You can do this from PHP with a system() call. It may be that your host has specified the rules too tightly. See also Special Purpose Environment Variables, and a number of blog posts one this.