[Resolved] .htaccess Gzip

Discussion in 'General' started by CapMur, Feb 6, 2010.

  1. CapMur

    CapMur New Member


    I was wondering what I'd need to stick in .htacces to gzip the regular JS/CSS? It's intended to be used on Wordpress if that makes any difference.

    EDIT: And also how do I add expires on the files.

    Last edited by a moderator: Jun 24, 2010
  2. NiteWave

    NiteWave Administrator

    gzip js/css is automatically done by lsws, you can config expires through web admin console or using apache's ExpiresByType, ExpiresDefault directives.
  3. chewbacca

    chewbacca New Member

    I can confirm that CSS is sent gzip'd, but no matter what I try for JS, it does not get compressed. I tried working around it by prepending a PHP script, but the content-type remains text/html even if I send a header stating otherwise.

    The <FilesMatch> .htaccess directive appears to void auto_prepend_file, but setting Expires works for JS files using <FilesMatch>. Now I'm out of ideas. I've Googled and searched these forums specifically, but I still couldn't find a definitive answer.

    Has someone experienced this issue before, and has anyone successfully fixed it? Thanks.
  4. NiteWave

    NiteWave Administrator

  5. chewbacca

    chewbacca New Member

    Ah, I'd seen that thread in the search results but couldn't mess with the configuration because this was on shared hosting.

    In the end, yes, that worked. My host was accommodating enough to make the change for me. Thank you.

Share This Page