• Resolved HKP

    (@hiskingdomprophecy)


    Hi Folks,
    After using W3TC for years I ran into issues and moved the JS & CSS to FVM with great results.
    Then W3TC issues got worse so changed to FVM & Cache Enabler (CE) after the WP-5 upgrades – with a bit of a speed loss – but increased stability.
    Then I found my speed dropped noticeably (about the time FVM came out with a lot of updates) and the Server Read Time became a huge issue.
    After months of work and testing all available WP cache options, I went back to FVM & CE as a simple stable – but slightly slower – combination.
    Then this week I found have had I no cache rules in my .htassess file….
    I copied in an old set and all was good again and the Server Read Time issues was resolved.
    I tested it today again on my pc version and after purging FVM from my system I reloaded FVM. The wp-content>cache>fvm was restored and all the JS & CSS files were processed.
    However I see nothing is added to the .htacces file.
    I have been searching the forum to find if FVM adds to the .htaccess file and if so, what?
    Can you please advise? If I need to add to the .htasses, please let me know what to add?
    I have found that both my live site and desktop version are acting in the same way on this.
    Regards and thanks, Angus

    • This topic was modified 5 years, 11 months ago by HKP.
    • This topic was modified 5 years, 11 months ago by HKP.
Viewing 7 replies - 1 through 7 (of 7 total)
  • G

    (@gnetworkau)

    FVM does not add anything to .htaccess.
    What helps speed on my server (a lot), is adding good directives for gzip and brotli compression, both for precompressed and on-the-fly compression. If you feel comfortable adding these to htaccess, reply here and I will post them. Not sure if this will help in your case, but I think this is the most overlooked tweak on WordPress servers.

    Thread Starter HKP

    (@hiskingdomprophecy)

    Thank you for your confirmation. That is most helpful.

    Certainly YES, interested in testing the gzip and brotli compression. We have users from all around the world, so any speed advantage we can provide them is worth investigation.

    FYI, we use the Weaver Xtreme theme which already optimizes CSS and JS, and scripts have to be executed in specific order, so any additional optimization on these will likely break things.

    As a result, although slower, we need to use your “Disable CSS processing” option, else it will not load the genericonsm and thus not render the pages correctly.

    Regards and thanks, Angus

    G

    (@gnetworkau)

    Ok Angus, you can try adding problem CSS/JS to “Ignore List” on the “Pro” tab.
    As for the gzip and brotli compression, see below for my crafted htaccess directives which are the best I have seen!
    Add them to htaccess before the WordPress default and caching directives.
    These directives (incl cache control) will serve compressed css,js and html files, in this order:
    – Precompressed Brotli (if file exists and clients accepts)
    – Precompressed Gzip (if file exists and clients accepts)
    – On-the-fly Compressed Brotli (if server enabled and clients accepts)
    – On-the-fly Compressed Gzip (if server enabled and clients accepts)
    – Uncompressed (if client does not accept compressed file format)

    # ===== BEGIN BROTLI =====
    # BROTLI Dynamic - Server Generated on-the-fly
    <ifmodule mod_brotli.c>
        AddOutputFilterByType BROTLI_COMPRESS text/html text/css text/javascript text/plain application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss
    </ifmodule>
    <IfModule mod_headers.c>
    # BROTLI Static - Precompressed
    # Serve Brotli compressed HTML, CSS and JS files if they exist and the client accepts brotli.
        RewriteCond "%{HTTP:Accept-encoding}" "br"
        RewriteCond "%{REQUEST_FILENAME}\.br" "-s"
        RewriteRule "^(.*)\.(html|js|css)"              "$1\.$2\.br" [QSA]
    # Serve correct content types, and prevent double compression.
        RewriteRule "\.html\.br$"  "-" [T=text/html,E=no-brotli:1,E=no-gzip:1]
        RewriteRule "\.css\.br$" "-" [T=text/css,E=no-brotli:1,E=no-gzip:1]
        RewriteRule "\.js\.br$"  "-" [T=text/javascript,E=no-brotli:1,E=no-gzip:1]
      <FilesMatch "(\.html\.br|\.js\.br|\.css\.br)$">
    # Serve correct encoding type.
        Header append Content-Encoding br
    # Force proxies to cache compressed/uncompressed files separately
        Header append Vary Accept-Encoding
      </FilesMatch>
      <FilesMatch "(\.js\.br|\.css\.br)$">
    # Cache Control and Enable CORS
        ExpiresActive On
        ExpiresDefault  "access plus 1 month"
        Header set Cache-Control "public, immutable, max-age=2628000, s-maxage=2628000"
        Header set Access-Control-Allow-Origin "*"
      </FilesMatch>
    </IfModule>
    # ===== END BROTLI =====
    
    # ===== BEGIN GZIP =====
    # GZIP Dynamic - Server Generated on-the-fly
    <ifmodule mod_deflate.c>
        AddOutputFilterByType DEFLATE text/html text/css text/javascript text/plain application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss
    </ifmodule>
    # GZIP Static - Precompressed
    <IfModule mod_headers.c>
    # Serve gzip compressed CSS and JS files if they exist and the client accepts gzip.
        RewriteCond "%{HTTP:Accept-encoding}" "gzip" [OR]
        RewriteCond "%{HTTP:Accept-encoding}" "deflate"
        RewriteCond "%{REQUEST_FILENAME}\.gz" -s
        RewriteRule "^(.*)\.(html|js|css)"              "$1\.$2\.gz" [QSA]
    # Serve correct content types, and prevent double compression.
        RewriteRule "\.html\.gz$" "-" [T=text/html,E=no-gzip:1,E=no-brotli:1]
        RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1,E=no-brotli:1]
        RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
      <FilesMatch "(\.html\.gz|\.js\.gz|\.css\.gz)$">
    # Serve correct encoding type.
        Header append Content-Encoding gzip
    # Force proxies to cache compressed/uncompressed files separately
        Header append Vary Accept-Encoding
      </FilesMatch>
      <FilesMatch "(\.js\.gz|\.css\.gz)$">
    # Cache Control and Enable CORS
        ExpiresActive On
        ExpiresDefault  "access plus 1 month"
        Header set Cache-Control "public, immutable, max-age=2628000, s-maxage=2628000"
        Header set Access-Control-Allow-Origin "*"
      </FilesMatch>
    </IfModule>
    # ===== END GZIP =====
    G

    (@gnetworkau)

    Thread Starter HKP

    (@hiskingdomprophecy)

    @gnetworkau
    Great! Thanks you!
    I’ll start having a look at this after I figure out all the them’s own CSS and dependent files to ignore, so I’ll be starting from a fully functioning setup which aids tweaking later.
    Regards and thanks, Angus

    Thread Starter HKP

    (@hiskingdomprophecy)

    @gnetworkau
    Thank you so very much!
    I use Pingdom Tools (PT) in Japan (JP) and Washington DC (DC) for testing load times.

    The stage results are:

    Before any changes you suggested: JP 828-874ms DC 2230-2590ms

    After adding Brotli & Gzip: JP 930-983ms DC 2230-2800ms

    After moving things around in .htaccess JP 682-785ms DC 1580-22420ms

    After excluding 1x font file and allowing CSS processing but no Britli or Gzip: JP 714-7236ms DC 1610-1620ms

    After excluding 1x font file and allowing CSS processing and with no Britli & Gzip: JP 644-715ms DC 1590-1310ms.

    This equates to a speed increase of from 18-49% or ave. 29%

    I am sure if I were to spend more time tweaking the system It will improve marginally, but this is really a great improvement.
    FYI, I also noticed in the testing that all the PT test locations are quite not configured the same – as different tweaks provided noticeably different results in JP than DC.

    Again, thanks so much for your advice.
    Regards and thanks, Angus

    Plugin Author Raul P.

    (@alignak)

    Sorry for the late reply.

    FVM does not add anything to .htaccess.

    Also:

    a) forget about pingdom tests, use gtmetrix.com instead. Reason… pingdom (usually) doesn’t detect gzip properly, doesn’t recognize brotli… and a few more outdated metrics.

    b) Use cloudflare.com free account. Not only you get a free cdn, but also brotli by default without worrying about your server. You can create a page rule on cloudflare, to cache everything on the uploads directory for 30 days on the edge, and 1 year for browsers.

    c) Use a cache plugin. W3TC will add those headers you are trying to add, however you must disable features that overlap with FVM.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘FVM HTACCESS’ is closed to new replies.