Using gzip to improve performance

wordpress

#1

I understand that it’s important to use gzip since it can reduce response time by 70%. How do I enable and/or use gzip on my wordpress site? I read in the dreamhost wiki that you can ssh into your theme and then manually gzip certain files. I did that with a few of my .js files and can see that there are now files with the .gz doctype, but will that do the trick? Do I need to do anything special in my apache .htaccess file? I’d rather not mess with the .htaccess if dreamhost is already set up for gzipping by default.

Also, what else should i gzip besides javascript files? Everything? CSS?

Thanks for the help!


#2

Actually the best thing would be to use gzip in your .htaccess file instead of manually doing it :slight_smile:

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip

Works nifty :slight_smile:


#3

Thanks for the reply. I opened .htaccess and it has this section, which looks like is all I need.
It sounds like you’re saying that based on this filter, I’m all set and don’t need to manually gzip javascript or css files. Is that right? If so, shouldn’t I expect to see the gzipped files? That is, shouldn’t I see style.css.gz as well as style.css?

Header append Vary User-Agent env=!dont-vary AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain$ # DEFLATE by extension AddOutputFilter DEFLATE js css htm html xml

#4

You don’t need to manually gzip anything, this will be dynamically handled for you, and you won’t see the files. They’re sneaky and totally transparent.


#5

If I enable cloudflare do I still need to use gzip?


#6

Need? No.

Will it hurt you if you do it anyway? Also no.

Basically if you’re gzipping on your own, CloudFlare honors it. If you’re not, they do it for you :slight_smile: