• Hi.
    I can enable within <wp-config.php>

    define(‘WP_CACHE’, true); //
    define(‘ENABLE_CACHE’, true); //
    define(‘CACHE_EXPIRATION_TIME’, 3600); //in seconds

    Does this resolve the issue of exploiting the browser cache (which requires you to set an expiration time for images and the like)?

    Thanks

Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Are you using any caching plugins? If not, try “Comet Cache”. One of the options is to enable browser caching in addition to server-side caching. If you’re using another caching plugin, be sure to check its options/settings.

    Thread Starter ceslad

    (@ceslad)

    I use AUTOPTIMIZE. Besides it, I also put in my .HTACCESS file a cache expiration time for browsers. It’s this one:

    #BEGIN cache
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault “access plus 1 month”
    ExpiresByType image/webp “access plus 1 month”
    ExpiresByType image/gif “access plus 1 month”
    ExpiresByType image/png “access plus 1 month”
    ExpiresByType image/jpg “access plus 1 month”
    ExpiresByType image/jpeg “access plus 1 month”
    ExpiresByType image/ico “access plus 3 month”
    ExpiresByType image/svg+xml “access plus 1 month”
    ExpiresByType text/css “access plus 1 month”
    ExpiresByType text/javascript “access plus 1 month”
    ExpiresByType text/html “access plus 1 month”
    ExpiresByType application/javascript “access plus 1 month”
    ExpiresByType application/x-javascript “access plus 1 month”
    </IfModule>
    #END cache

    How do I enable the browser cache in addition to the server side cache?
    Thanks

    • This reply was modified 7 years, 1 month ago by ceslad.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    The stuff in your .htaccess file enables the client-side cache. (I use autoptimize on almost all my sites, along with either WP Super Cache or Comet Cache.)

    Thread Starter ceslad

    (@ceslad)

    This stuff in my .HTACCESS file I use to improve GOOGLE score. That score that talks about <Take advantage of browser cache>.

    I’m also having another problem.
    My site is stored in the browser cache.
    When I make a new product post for sale, it does not appear in the browser.
    I always need to give <f5> an update.

    It turns out that the client (Internet user) will not do this. That is, what he will see will always be old content.
    How would you resolve this issue?

    Thanks..

    • This reply was modified 7 years, 1 month ago by ceslad.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What plugins are you using for caching? You have yet to answer that.

    Thread Starter ceslad

    (@ceslad)

    Use the autoptimize. Only him.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Then some of the other caching you’re doing may be causing the issue. A perfect Google score is not always consistent with a properly working website.

    Thread Starter ceslad

    (@ceslad)

    As I told you, the cache I use is this below (it’s placed in .htaccess)

    #BEGIN cache
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault “access plus 1 month”
    ExpiresByType image/webp “access plus 1 month”
    ExpiresByType image/gif “access plus 1 month”
    ExpiresByType image/png “access plus 1 month”
    ExpiresByType image/jpg “access plus 1 month”
    ExpiresByType image/jpeg “access plus 1 month”
    ExpiresByType image/ico “access plus 3 month”
    ExpiresByType image/svg+xml “access plus 1 month”
    ExpiresByType text/css “access plus 1 month”
    ExpiresByType text/javascript “access plus 1 month”
    ExpiresByType text/html “access plus 1 month”
    ExpiresByType application/javascript “access plus 1 month”
    ExpiresByType application/x-javascript “access plus 1 month”
    </IfModule>
    #END cache

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Yes. try removing the text/html one.

    Thread Starter ceslad

    (@ceslad)

    Hi, @sterndata.

    I’m using the <autoptimize> cache. But I also have my server cache enabled.
    What would be the difference between these two caches? Would the two have the same function? Could I disable one and just stick with another? What do you recommend?
    Thanks..

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    autoptimze concatenates and minifies CSS and JS, it doesn’t cache anything. So your server should cache the output of autoptimize (that’s really hard to type correctly!) and improve performance for your site. If your server does caching, you probably should not use a caching plugin.

    Evaluate your site as a human. Does it seem to load quickly? If so, good. Forget about what the various speed tests say. You build your site for humans to use, not to impress Google.

    Thread Starter ceslad

    (@ceslad)

    @sterndata, see in this image of the autoptimize settings the plugin cache. I put a black circle around.

    • This reply was modified 7 years, 1 month ago by ceslad.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Yes, those are the files that have been, if I may verb it, autoptimized. They are cached so they don’t have to be regenerated on each page view.

    Thread Starter ceslad

    (@ceslad)

    @sterndata, my server cache stores files, pages, etc. That is, when people access the site, they are viewing a site from the server cache.
    Already the cache of the plugin Autoptimize has another function: to store files that have been optimized by the plugin.
    This plugin does not have the same function as the server cache. Was it, then?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘How to take advantage of browser cache?’ is closed to new replies.