Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Cache busting problems

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #209106
    Alex Zaworski
    Participant

    Hi friends.

    I’m working on a WordPress site. I’m using query params to cache bust css/js which is working fine, but I’m having issues where the page itself is cached (in its entirety) which means the css/js files aren’t getting the cache-bust parameters tacked on unless I force a refresh. I use MediaTemple’s caching plugin, but this is including after I flush that cache.

    Is this an htaccess thing? I’m new to server-y things, here’s my .htaccess file if it helps!


    # BEGIN WordPress <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 #disallow access to config <Files wp-config.php> order allow,deny deny from all </Files> #disable directory browsing Options -Indexes # BEGIN EXPIRES <IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 10 days" ExpiresByType text/css "access plus 1 year" ExpiresByType text/javascript "access plus 1 year" ExpiresByType text/plain "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/svg+xml "access plus 1 year" ExpiresByType application/x-javascript "access plus 1 year" ExpiresByType application/javascript "access plus 1 year" ExpiresByType application/x-icon "access plus 1 year" </IfModule> # END EXPIRES AddType image/svg+xml .svg AddOutputFilterByType DEFLATE image/svg+xml
    #209312
    Alex Zaworski
    Participant

    Still having problems with this — anyone have ideas? Recently it’s been super problematic when adding new items to our main nav menu, I’ve had users need to refresh every cached page to see the new menu items. Not good :(

    #209314
    Alex Zaworski
    Participant

    Bear with me, my knowledge of caching is limited and I will almost certainly say stuff that is super wrong and/or not actually coherent :)

    I’ll try to break down the situation step by step:

    • I’m caching static content (css/js) with expires headers, so far so good
    • Obviously if I make changes I need to bust the cache, to do so I’ve elected to use filemtime as the version number using WordPress’s built-in enqueue script/style functions
    • This works great… when the version is actually appended as a parameter
    • Often, the page itself is in the browser cache (I think? Man I could be totally off here), which means an old version with old parameters gets served and nothing updates.
    • I’m also having problems where, for example, I add an item to our nav bar. If the browser pulls an old version, the changes aren’t displayed and that page will show an old menu. This is really, really bad for us.
    • As far as I can tell this can’t be a server cache issue since it’s fixed by forcing a refresh on the page.

    Also, I don’t totally understand the snippet you’ve shared — does that disable caching entirely? I’d rather not do that. Perf matters and all that jazz.

    #209316
    Alex Zaworski
    Participant

    I guess my issue is a lack of familiarity with browser caching — I’ll keep poking around (site won’t be fully live for a couple months regardless) and look into the option of using cookies if I’m still not able to solve the problem.

    Really appreciate your help, thank you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Other’ is closed to new topics and replies.