WP Super Cache – max-age

Reading the plugin FAQ:

http://wordpress.org/extend/plugins/wp-super-cache/installation/

Read More

After you have enabled the plugin, look for the file “wp-content/cache/.htaccess”. If it’s not there you must create it. It should read:

# BEGIN supercache <IfModule mod_mime.c> <FilesMatch ".html.gz$"> ForceType text/html FileETag None </FilesMatch> AddEncoding gzip .gz AddType text/html .gz </IfModule> <IfModule mod_deflate.c> SetEnvIfNoCase Request_URI .gz$ no-gzip </IfModule> <IfModule mod_headers.c> Header set Cache-Control 'max-age=3, must-revalidate' </IfModule> <IfModule mod_expires.c> ExpiresActive On ExpiresByType text/html A3 </IfModule> `` # END supercache

The Question is why

Header set Cache-Control ‘max-age=3, must-revalidate’

must be 3 seconds?

Shouldn’t this be much higher? Can i change this value to let’s say 604800 ?

This is my own scenario:

  1. I dont allow comments
  2. I don’t have dynamic widgets
  3. I post every day but i don’t bother if my content is shown a few hours after
  4. I run an XML import every week – adding about 500 posts in one hour

Quote: Most users will not even notice the cache validation requests, but delivering outdated cache files is much more visible. – I am doing this more for SEO purposes – please look at: http://seobyg.com/http-header/cache-control

i think it does matter for SEO to have a high max-age – right ?

Related posts

2 comments

  1. The best value depends on the dynamic content you have:

    • If there are widgets which should be up to date each time, you cannot use a long value, or your visitors will get outdated content. That’s often not a problem though.
    • The value should not be longer than your average post frequency. If you add a new post two times per day, you probably want to show that your visitors early enough.
    • If you enabled comments, you should use a low value, at least for posts. Otherwise your visitors will think their comment wasn’t sent, because they will get the unchanged page after submitting a comment.

    I think, the recommended value is the one that avoid too much support questions. Most users will not even notice the cache validation requests, but delivering outdated cache files is much more visible.

    You should run some experiments and increase the max-age value in small steps until you note side effects. Start with 30 seconds, then double the value each week. I don’t think there are important SEO effects. Other factors are much more important.

    For a project a long time ago I developed a dynamic value:

    max-age = (now - last-modified) / 2
    

    But you cannot do that in a .htaccess file, because the server doesn’t know when a post was last modified in the database.

  2. Just to be clear: this max-age refers to the external caching – that is, to how long the page is cached in the BROWSER. You don’t want the browser to cache pages for a lengthy time. If you fix as much as a typo in a post, that page will still show the error because it comes from the browser’s cache.

    The max-age is NOT how long WP Super Cache caches the page. That can be set based on your garbage collection – or even indefinitely (i.e., as long as the post was not edited). If you have no dynamic content on the page, then by all means set WP Super Cache time to a lengthy one. But you don’t want the BROWSER to cache it for a lengthy time (as opposed to really static assets, such as js, css, images, etc – that should be cached by the browser for a day or a week or even a month, because they normally seldom change).

Comments are closed.