I have shared hosting through Justhost. I use the HTML5 Boilerplate .htaccess (have tried other methods from here and there without luck) the compression part is as follows:

<IfModule mod_deflate.c>

  # Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
  <IfModule mod_setenvif.c>
    <IfModule mod_headers.c>
      SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
      RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding

  # Compress all output labeled with one of the following MIME-types
  <IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/atom+xml \
                                  application/javascript \
                                  application/json \
                                  application/rss+xml \
                                  application/vnd.ms-fontobject \
                                  application/x-font-ttf \
                                  application/xhtml+xml \
                                  application/xml \
                                  font/opentype \
                                  image/svg+xml \
                                  image/x-icon \
                                  text/css \
                                  text/html \
                                  text/plain \
                                  text/x-component \


However, it isn't working—at least I don't think—My home page (html) isn't compressing, the CSS and some of the JS aren't gzipped.

It is failing on HTML, CSS and JS.

However, some things are (or were, who knows what it will look like when you check) gzipped.

My domain is http://adaminfinitum.com/

What is weird is that the (Google) PageSpeed browser extension for Firefox (whatever the current version is [Nov. 2012]) gives me a 95% speed rating (and no warnings about compression), yet YSlow and Chrome developer tools both flag me about gzip, as does a tool I found on here while researching this.

To reduce cookies I set up a subdomain on my site and I thought maybe that was it so I added an .htaccess there also, but no luck.

To reduce http requests I embedded some of webfonts and images in CSS (HTML5 BP stipulates not to compress images, and apparently '.woff' files are already compressed) so I thought maybe that was it and I spent all day separating and asynchronously loading those portions (via Modernizr.load) but that hasn't helped either...if anything it made it worse due to increasing http requests (I realize speed scores of async resources may be misleading).

Researching this, it seems to be a fairly common issue but I haven't found an explanation/solution.

I don't think it is a MIME-type issue, I have quadruple checked (and thrice edited) my .htaccess files.

My hosting company said they run Apache 2.2.22 and I have looked at everything I can find.

What gives?

  • "I use the HTML5 Boilerplate .htaccess". No, you don't. There is no connection between HTML (any version) and .htaccess. One tells the browser how to render the page. The other provides web server directives. Nov 12, 2012 at 5:36
  • I meant that because this is new to me and unfamiliar I use the .htaccess file that is included in HTML5 Boilerplate downloads, the current version of which is here: github.com/h5bp/html5-boilerplate/blob/master/.htaccess
    – adam-asdf
    Nov 13, 2012 at 10:31

1 Answer 1

  1. Mod_Deflate is a module that CAN be loaded, it is not a part of Apache in any version.
  2. .htaccess files MAY contain "override" directives. Which ones can be administratively controlled in Apache's main configuration files, they can even configure Apache to use a different file name. Just because you put something in an .htaccess file doesn't mean Apache can or will do anything with it.

You'll have to contact your host to determine if and how to configure compression.

  • Sorry, that probably came across a bit harsh, I didn't intend it that way. I just wanted to stress that when you're using hosting like this the various options are highly controlled by the host, and not the customer. If you want to be able to have a high degree of control you'd have to run Apache yourself, a VPS, Dedicated Server, or your own Hardware.
    – Chris S
    Nov 12, 2012 at 4:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .