Support » Plugin: W3 Total Cache » Sitemap.xml files getting minified and cached

  • Resolved ScalarEnt

    (@scalarent)


    Hi, W3 total cache seems to be minifying the Yoast SEO generated sitemap XML files. If I purge the caches and then open any of the sitemap files it displays the correctly formatted content. However, if I then refresh the browser, the page content gets minified and stays like that (cached?). The only way to get it to display correctly again is to purge the caches.

    Comment from XML source:

    <!–
    Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

    Page Caching using disk: enhanced
    Minified using disk (Request URI is rejected)

    Served from: marlacustomblinds.co.uk @ 2020-12-10 15:14:21 by W3 Total Cache
    –>

    I can repeat this behaviour on 2 other websites (2 different hosting) with exactly the same results.

    I have updated the plugins to the latest versions but it remains the same.

    I have tried adding Yoast’s suggested code to “Never minify the following pages:” setting under Performance > Minify > Advanced (section).

    sitemap(_index)?\.xml(\.gz)?
    [a-z0-9_\-]*sitemap[a-z0-9_\-]*\.(xml|xsl|html)(\.gz)?
    ([a-z0-9_\-]*)?\.xml

    But it does not fix the problem.

    Same behaviour seen in Firefox and Chrome browsers.
    WordPress 5.5

    Any suggestions ?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @scalarent

    I am sorry about the issue you are experiencing with the sitemap and I am happy to assist you with this.
    I’ve tested and tried to validate your sitemap and got the following:
    Incorrect http header content-type: "text/html; charset=UTF-8" (expected: "application/xml")
    Please go to Performance>Page Cache, scroll all the way down to the bottom of the page and make sure that the option: Handle XML mime-type is enabled, if not, enable it, save all settings and purge the cache. This option ensures that the correct Content-Type header for XML files is returned(e.g., feeds and sitemaps).
    I hope this helps!
    Thanks!

    Thread Starter ScalarEnt

    (@scalarent)

    Hi Marko,

    Thanks for your prompt response.

    That seems to fix the problem – thank you.

    One thing – I looked at that checkbox again after setting it, saving and purging and it is no longer ticked. Is that correct ? (the problem is still fixed however).

    Best regards

    Steve

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @scalarent

    Thank you for the information. I am glad to know the issue is resolved.
    That option should be automatically enabled if the option Cache feeds: site, categories, tags, comments is also enabled. and vice versa.
    I’ve tested the sitemap and it’s not showing any errors.
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sitemap.xml files getting minified and cached’ is closed to new replies.