• Resolved activelightning

    (@activelightning)


    Hi,

    I am attempting to get my browser caching to work and for some reason, it will not work. I’ve SSH’ed into my server and enabled the expires module:

    Loaded Modules:
     core_module (static)
     so_module (static)
     watchdog_module (static)
     http_module (static)
     log_config_module (static)
     logio_module (static)
     version_module (static)
     unixd_module (static)
     access_compat_module (shared)
     alias_module (shared)
     auth_basic_module (shared)
     authn_core_module (shared)
     authn_file_module (shared)
     authz_core_module (shared)
     authz_host_module (shared)
     authz_user_module (shared)
     autoindex_module (shared)
     deflate_module (shared)
     dir_module (shared)
     env_module (shared)
     expires_module (shared)
     filter_module (shared)
     headers_module (shared)
     mime_module (shared)
     mpm_prefork_module (shared)
     negotiation_module (shared)
     php7_module (shared)
     reqtimeout_module (shared)
     rewrite_module (shared)
     setenvif_module (shared)
     socache_shmcb_module (shared)
     ssl_module (shared)
     status_module (shared)

    From there, I went in and auto-enabled the plugin, which created this in my .htaccess file:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    
    # BEGIN WP-HUMMINGBIRD-CACHING
    # The directives (lines) between "BEGIN WP-HUMMINGBIRD-CACHING" and "END WP-HUMMINGBIRD-CACHING" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0
    <FilesMatch "\.(txt|xml|js)$">
    ExpiresDefault A31536000
    </FilesMatch>
    <FilesMatch "\.(css)$">
    ExpiresDefault A31536000
    </FilesMatch>
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$">
    ExpiresDefault A31536000
    </FilesMatch>
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
    ExpiresDefault A31536000
    </FilesMatch>
    </IfModule>
    <IfModule mod_headers.c>
      <FilesMatch "\.(txt|xml|js)$">
       Header set Cache-Control "max-age=31536000"
      </FilesMatch>
      <FilesMatch "\.(css)$">
       Header set Cache-Control "max-age=31536000"
      </FilesMatch>
      <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$">
       Header set Cache-Control "max-age=31536000"
      </FilesMatch>
      <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$">
       Header set Cache-Control "max-age=31536000"
      </FilesMatch>
    </IfModule>
    # END WP-HUMMINGBIRD-CACHING

    From there, I cleared all my cache, enabled and disabled the caching, and still no success. Does anyone have any advice?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @activelightning ,

    Could we know what exact error message you notice in “Browser Caching” page under Hummingbird > Caching > Browser Caching

    The code in .htaccess does look fine too. Could you please try clicking the “Re-Check Status” button and then check whether it makes any difference?

    If you still have issues even after that then please do share a full-page screenshot on what exactly you notice in “Browser Caching” page so that we could have a better idea.

    Looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter activelightning

    (@activelightning)

    Hi Nithin,

    I’ve hit the recheck button and still have the same issue. You can find an attached image of the error here

    In addition, this is the error in plain text:
    Browser Caching is not working properly:

    – Your server may not have the “expires” module enabled (mod_expires for Apache, ngx_http_headers_module for NGINX)
    – Another plugin may be interfering with the configuration
    If re-checking and restarting does not resolve, please check with your host or open a support ticket with us.

    Thanks for your help,
    Andrew

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @activelightning

    Thanks for sharing a screenshot. Could you please check whether zlib.output_compression is enabled or not?

    If not, to enable it, you can create php.ini file in the root directory and add the following:
    zlib.output_compression = On

    The root directory is where the wp-config.php file, /wp-content/, /wp-admin, /wp-include folders reside.

    Once done please click the “Re-Check Status” button and then see whether it makes any difference. Please do make sure to restart the server to ensure the changes are reflected.

    Please do let us know how that goes.

    Kind Regards,
    Nithin

    Thread Starter activelightning

    (@activelightning)

    Hi,

    I’ve followed the instructions and did the restart to apache and nothing has changed. I did create the php.ini file and put the line:
    zlib.output_compression = On

    Do you have additional ideas? The error message stays the same. I’ve activated / deactivated, rechecked, and cleared my cache.

    Thanks,
    Andrew

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @activelightning ,

    I’m sorry for the delay on our end, looks like we didn’t receive the email notification for your last message.

    In this case, can you try a plugin conflict test? You can read about it here https://premium.wpmudev.org/blog/wordpress-plugin-conflicts-how-to-check-for-them-and-what-to-do/

    kind regards,
    Kasia

    Thread Starter activelightning

    (@activelightning)

    I’ve checked for conflicts and none of my plugins are modifying the same files.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @activelightning

    Could you double-check if the mod_deflate is well configured?

    Scroll to configuration section:
    https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-mod_deflate-on-ubuntu-14-04
    https://www.digitalocean.com/community/questions/htaccess-doesn-t-work-on-ubuntu-droplet

    And if the local htaccess can override the Apache htaccess.

    Also, is it an Apache only server, or Nginx and Apache?

    Best Regards
    Patrick Freitas

    I finally figured out the 4 cache expiry thing not working in hummingbird (they always showed up yellow either disabled or false.

    The added caching code for some reason was not picked up wordpress when the code is added to htaccess.

    To get it to work I had to move that code to my apache2.conf and then finally everything lit up green.

    I read every single post on this issue in the top 10 google response and I can’t beleive I didnt find it.

    Ron

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @rjohnsonfbr1us

    I’m happy to hear you found the issue.

    Yes, the apache2.conf need to allow the local htaccess to override the settings to make it work, or place it directly on the apache file.

    I will go ahead and mark this ticket as resolved but feel free to let us know if you have any further question.

    Best Regards
    Patrick Freitas

    Thread Starter activelightning

    (@activelightning)

    I’ve tried adding this directly to my apache conf file and it hasn’t done anything. I still get the same error.

    Hi @activelightning,

    Browser Caching is a server side thing and Hummingbird tries to apply the required rules but it still depends on the server to allow these rules to work and to overwrite server settings.

    At this point I would suggest getting in touch with your hosting provider to check this further for you and see why the rules are not working with their server setup.

    Cheers,
    Predrag

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Browser Caching Not Working’ is closed to new replies.