Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed an error in google webmaster tools regarding a gzipped version of a sitemap. Turns out the sitemap.xml.gz file is gzipped twice: one upon creation (as it should be) and another time when being served.

The .htaccess file has this rule

AddOutputFilterByType DEFLATE application/xml

which I thought wouldn't match a gzipped XML file, but apparently it does as removing this solves the problem.

What am I doing wrong?

share|improve this question
up vote 7 down vote accepted

The .xml.gz filetype may be defined as being an xml file (e.g. with forcetype in a filesmatch block) - which would cause Apache to match it to the type above.

I think you can get around that by adding an exception, above it:

SetEnvIfNoCase Request_URI ".xml.gz$" no-gzip dont-vary

You might want to see HowToForge for more exceptions to add.

Hope it works for you.

share|improve this answer
This works perfectly, although I haven't found anything in the htaccess or in the vhost configuration which would force gzip files to have application/xml MIME type – Matteo Riva Jul 7 '11 at 9:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.