2012-10-08 10:02, James Dow Allen wrote:
> I have my own hobby website
> http://fabpedigree.com
> Most of the pages change about once per month.
Check out
http://redbot.org/?uri=http%3A%2F%2Ffabpedigree.com
for a quick cacheability analysis. Browsers will make their own
analysis, mainly based on the Last-Modified header.
> When I access it myself with Firefox I often get old versions.
This is a common fallacy among authors. At present, when Last-Modified
means that the page was modified a few days ago, browsers probably treat
it as cacheable for some minutes, or maybe a few hours. Now, as an
author, you may have opened the page in a browser, perhaps closed the
browser, edited the page, and then open it again. The browser will use
the cached copy, for apparent reasons. What are the odds that this
happens to a casual surfer?
> It would be
> inconvenient to add EXPIRES directives to the html
> pages, as I don't know in advance when the page will
> be obsoleted.
EXPIRES means that the cached copy will be treated as stale. This is
something you do on the basis of estimates and guesses, not exact
computation of the future.
> I wish there were a .htaccess or html directive like
> "Don't keep any cached pages for more than a week."
There are no directives in HTML.
But there is such a directive in Apache, see
http://httpd.apache.org/docs/2.2/mod/mod_expires.html
By setting
ExpiresByType text/html "access plus 7 days"
you are effectively imposing an upper limit on the lifetime of a cached
copy of any HTML document.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/