Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 6 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

 
discard

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.