An, "Enable Compression" query.. (10 posts)

  1. ttj90
    Posted 4 years ago #

    Google Page Speed and other sites alike state that certain pieces could do with being compressed under the 'High Priority' section or similar.

    I was wondering then, when I go into cPanel and go into File Manager and select the files that needs compressing, can I then do it from there by selecting the GZip Archive? It seems so easy so I'm wondering about a catch somewhere. I'm on new territory you see and I'm not a developer. An autodidact perhaps but a poor one. It's the theme .css files I'm trying to compress. Could I also do this with the .js files as well whilst I am at it? Would this help with the 'Defer parsing of JavaScript'? That's next on my list then I'll not bother with any more.

    I'm on a shared server by the way and my site is http://thetruejoe90.com

  2. Alas, that's not how it works :) You'd want to use a aplugin, but first you need to make sure mod_gzip is running on your server.

    Ask your host first, and if they say it is, try using WP Super Cache, or W3 Total Cache to do that.

  3. ttj90
    Posted 4 years ago #

    I have got WPSC in place but some of the files are not being compresed according to Page Speed.

    I've asked my Host and they tell me this:

    "Unfortunately we do not provide mod_gzip or mod_deflate on our shared servers.
    File compression of static content is possible on Apache web hosts that do not have mod_gzip or mod_deflate enabled
    Use 7-Zip (quite possibly the best compression software around, and it’s free) to compress the CSS and JavaScript files as gzip, then upload them to your server. Add the following lines to your .htaccess file to send user agents the gzipped versions if they support the encoding"

    <files *.js.gz>
     AddType "text/javascript" .gz
     AddEncoding gzip .gz
    <files *.css.gz>
     AddType "text/css" .gz
     AddEncoding gzip .gz
    RewriteEngine on
    #Check to see if browser can accept gzip files.
    ReWriteCond %{HTTP:accept-encoding} gzip
    RewriteCond %{HTTP_USER_AGENT} !Safari
    #make sure there's no trailing .gz on the url
    ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
    #check to see if a .gz version of the file exists.
    RewriteCond %{REQUEST_FILENAME}.gz -f
    #All conditions met so add .gz to URL filename (invisibly)
    RewriteRule ^(.+) $1.gz [QSA,L]

    So I am to assume that I download the .js and .css files to my computer, use 7-Zip to compress them, then re-upload them into File Manager and input this code into .htaccess?

  4. It might work, but keep in mind you'd have to regenerate that every time you change anything on your theme/site design

    Ugh, seriously? They don't use mod_gzip or mod_deflate?

  5. ttj90
    Posted 4 years ago #

    That's what they say. Not on shared servers.

    I've had it confirmed that it'll work but I always want a second opinion hence why I've asked on here. I have more trust in the WP Forums than what I do when dealing with my Host.

    How do you mean 'regenerate that every time you change anything on your theme/site design'?

  6. Your .js and .css files for WP are specific to your theme. Change that and you have to re-zip or people will get an inconsistent experience.

  7. ttj90
    Posted 4 years ago #

    But if I'm just doing new posts and additional text then I shouldn't have a worry then? If I'm happy with the theme as it stands then I could go ahead and do this then.

  8. Oh yes, you should be fine :) Just want to make sure you understand this.

  9. ttj90
    Posted 4 years ago #

    I'll give it a whirl then.

    Thanks for taking the time out to help, I appreciate it.

    I'll get back to this thread when I see or if I see any happenings to help out the greater good!

  10. ttj90
    Posted 4 years ago #

    I hope it works in all browsers though...

Topic Closed

This topic has been closed to new replies.

About this Topic