• I’ve been taking steps to improve the speed of my blog, https://epicalex.com/ , one of which is the use of the wp-super-cache plugin.

    I’ve also been using the YSlow firefox plugin, that tells you why your site might be loading slowly. One of its complaints is that my stylesheets and javascript files are not gzipped, but gzipping is enabled in wp-super-cache.

    Is there anything I have to do differently to get them to be gzipped? or can I do it manually somehow, or am I trying to do this for no real reason?

    Thanks in advance,

    Alex

Viewing 5 replies - 1 through 5 (of 5 total)
  • it requires a whole different beast. try phpspeedy or phpspeedy wp plugin @ https://aciddrop.com/

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    I like this little hack for that sort of thing.

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP:accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME} !^.+\.gz$
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.+) $1.gz [L]
    </IfModule>

    This would need to be before the normal .htaccess rules in WordPress, or in a separate .htaccess file in your theme directory.

    Basically, if the browser doing the request says that gzipped files are okay, and there exists a gzipped version of a file, it will send that instead. So all you have to do for your css file is to make another copy of it, gzipped, with an extra .gz extension. Like “style.css.gz”. Then that one will get sent instead of the original for browsers that can handle it.

    It’ll work for JS files too. Use the 7Zip compressor to make a gzipped version of it, load it in the same directory as the original and voila.

    Note: You have to keep the original around too, for those cases where this won’t work. Also, when you make changes, you’ll need to manually recompress the new file.

    Thread Starter Alex Cragg

    (@epicalex)

    So just to make sure I’m doing this right as this stuff is all new to me(I tried it and my jquery effects stopped working, but the gzipped version was served)…

    In my main .htaccess, I have this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond .... ALL THE NORMAL WP SUPER CACHE CONDITIONS AND RULES
    <IfModule mod_rewrite.c>
    NORMAL WORDPRESS CONDITIONS HERE -f and -d ETC
    </IfModule>
    </IfModule>
    # END WordPress

    Where do I put this new rule Otto? And do I include all of the IfModule part?

    Also, when I used the 7zip compressor, I just used the default settings, but when I looked at the script panel of firebug, all I could see was 2 or 3 weird symbols, like G@ for example. Is that how it should appear…I’m guessing not?

    Thanks again

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    You’d put the new code before all of that, outside the #BEGIN and #END stuff entirely. Never change anything inside that section, consider that to be WordPress’s private domain.

    Or, like I said, you could put the rules in an .htaccess in the theme directory directly.

    I don’t really use the 7zip compressor, so I don’t know much about it. I just read that it was possible to make gzip’s with it on Windows. I personally make gzips using gzip on a Linux box. You could use this instead, I suspect:
    https://gnuwin32.sourceforge.net/packages/gzip.htm

    Complete noob to www.remarpro.com here though I have done a decent amount of research to get to this point. I’m trying to make the site as fast as possible. I was unable to get wp-super-cache to work (the directory doesn’t get created) though wp-cache works so at least I have that much working.

    I’m wondering if it is possible to configure combine.php on top of wp-cache or whether I’d have to use one or the other.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to GZIP my stylesheet and js using wp-super-cache’ is closed to new replies.