XML sitemap header wrong after caching
-
We’ve written our own XML sitemap generator, which returns a Content-Type header like so:
header( ‘Content-Type: text/xml’ );
When viewing the sitemap page for the first time, the browser renders it as XML. However, once it is cached, subsequent calls return a Content-Type of text/html and the browser doesn’t render the XML (or the linked XSL stylesheet file).
I notice the same behaviour too with the Yoast SEO plugin and their sitemap.
What is the correct way of ensuring the text/xml header is honoured after the page is cached?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘XML sitemap header wrong after caching’ is closed to new replies.