Tagged: Browser Cache
- AuthorPosts
- August 13, 2021 at 5:29 pm #41722Oliver DGuest
HTML & XML share the same settings for “Expires header lifetime:”, under Browser cache. We have set it to an hour which is fine for pages, but we would like our RSS feeds to update more frequently. Is there a way to overwrite this setting? programmatically maybe?
August 13, 2021 at 7:01 pm #41743Jesse OwensKeymasterHi Oliver-
Thanks for reaching out! By default, the three MIME types (CSS/JS, HTML/XML, and Other) for Expires Headers are hard-coded into W3 Total Cache and can’t really be modified programatically.
However, you can accomplish this goal with a manual rule in your .htaccess file.
You can add a chunk of code after the line
# END W3TC Browser Cache
similar to this:<IfModule mod_expires.c> ExpiresByType text/xml A300 </IfModule>
In this example, the XML file’s expiration would be set to Access plus 5 minutes (300 seconds). Be careful if you copy-and-paste that, sometimes the < and > characters don’t come through in the forum well, so double-check that they are carets and not & characters.
I should also note that I couldn’t find a definitive rule in Apache’s mod_expires about what happens when the ExpiresByType is duplicated, but in all of the browsers that I tested, this solution worked.
- AuthorPosts
- The topic ‘Set expires header lifetime different only for XML feeds’ is closed to new replies.