I enabled gzip/Deflate compression on our servers per Google's Page Speed directives, and it looks like it's now compression html/php files, but a couple file formats aren't being compressed that Google rightfully is saying should be compressed, namely .js and .ttf files. How do I add more file formats to httpd.conf so they're compressed as well?

Current lines in httpd.conf I have are:

# Deflate output configuration
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

Is it as simple as adding text/js and text/ttf?

1 Answer 1


Yep. Just add more types:

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript application/x-font-ttf
  • Thanks. I added those, restarted apache, and Google still complains that a .js file and .ttf files aren't gZipped.
    – Keefer
    Dec 8, 2011 at 15:44
  • 1
    If you use Firebug you should be able to see if it is compressed or not. Check that to see if this is working or not. Also, while testing, I would use htaccess for this. Then once you're sure it is working properly update your http.conf file with the final content. It will be faster for you to test that way.
    – John Conde
    Dec 8, 2011 at 15:46
  • Where in Firebug will I see if the ttf and js a deflated?
    – Keefer
    Dec 8, 2011 at 15:54
  • In the "Net" tab look for a ttf file and click on it. You'll see the headers. If you see "Content-Encoding gzip" it is compressed.
    – John Conde
    Dec 8, 2011 at 15:57
  • The .js files are being in fact showing in Firebug as gzipped. Google's analysis is just flawed? I can't check in Firebug the ttf's though, as Firefox loads the .woff font files instead.
    – Keefer
    Dec 8, 2011 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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