Support » Plugin: Simple Wp Sitemap » Conflict With WP Super Cache

  • Resolved linux4me2


    I noticed a problem when I viewed the sitemap.xml file on some sites. The XML file was displayed without any of the CSS, so it was just an uninterrupted string of all the URLs generated instead of the neatly arranged list I saw on sites where the XML displayed correctly. The oddest thing is that it affected some sites and not others, even though they were running the same theme and plugins. When I tested the site on XML Sitemap Validator, it showed the file was not valid due to “Incorrect http header content-type.” There were no PHP errors or any errors when I enabled WP_DEBUG. There were no visible blank lines at the top of the file when I looked at the source of the sitemap.xml page. If I copied-and-pasted the source into a text document, saved it as a *.xml file, and opened it in Firefox, it displayed correctly.

    It turned out the problem was with WP Super Cache. Even when I was logged in and WP Super Cache was not caching the page, on the affected sites, Firefox Developer tools showed that the lines:

    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/css" href=""?>

    were commented out with HTML comments. I think that WP Super Cache must have been adding some kind of characters to the beginning of the file, but nothing showed up when viewing the source. I verified that I was using exactly the same settings for WP Super Cache on the affected sites as I was on the unaffected sites. I took a look at some other sites using other XML sitemap plugins, and found that this problem isn’t limited to Simple WP Sitemap.

    The workaround was to add the sitemap to the list of files not to be cached in WP Super Cache -> Advanced -> “Add here strings (not a filename) that forces a page not to be cached:”


    Once I did that, the sitemap.xml displayed correctly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just marking this solved since there is a workaround, and the problem doesn’t appear to be with this plugin, but with WP Super Cache.

    Plugin Author Webbjocke


    Hi this is not so good. It seems like super cache just sets the header “text/html” for all cached files, even for xml. However fortunately enough google and bing etc still accepts the xml sitemap, since the only thing invalid about it is the http header. The reason it looks really bad is because your web browser think it’s an html page instead of xml and then doesn’t load the xml css file.

    But great you found an easy solution!

    Thanks for the information.

    It seems like super cache just sets the header “text/html” for all cached files, even for xml.

    Ah, that explains why I wasn’t seeing any errors and the XML CSS was commented out by my browser.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conflict With WP Super Cache’ is closed to new replies.