Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41722
    Oliver D
    Guest

    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?

    #41743
    Jesse Owens
    Keymaster

    Hi 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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Set expires header lifetime different only for XML feeds’ is closed to new replies.