Forum Moderators: coopster
start here with this post on if modified since [webmasterworld.com]
and read web-caching.com - a very useful resource.
we send the last modified date of the script with the line:
header("Last-Modified: $last_modified");
where $last_modified is in this format:
Thu, 8 Apr 2004 07:43:40 GMT
you can work out your last modified date for each script either using filemtime(), or if using dynamic content by comparing the filemtime() with the timestamp value of your databased data and send the most recent one as your last_modified header.
many sites don't bother, as depending on the complexity of your scripts and database calls, it can be more trouble than it is worth to calculate. see this post here on why so many php sites don't use last modified headers [webmasterworld.com]
you can use the header checker [searchengineworld.com] on this site to see if you are returning the last modified date correctly
imo if you are not using any databased data, then there is no excuse for not sending correct last mod headers ;-)
good luck
we don't bother with content length and have never found any problems with caching. you could send content length like this (if using output buffering)
$content_length = ob_get_length();
header("Content-length: $content_length");
cheers