homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Testing cacheability
What does this mean and what else should I be doing
aijohn




msg:1249075
 6:28 am on Aug 25, 2005 (gmt 0)

I have dynamic pages that get content from a database. I have written some code to send a last modified header when significant revisions are made in the content test.

Found a site that tests this and improved from no info to the message below. have I accomplished anything as far as conveying to search engines that there is fresh content and what else do I need to do?

Suggestions, anyone?

Wrong forum?

This object doesn't have any explicit freshness information set, so a cache may use Last-Modified to determine how fresh it is with an adaptive TTL (at this time, it could be, depending on the adaptive percent used, considered fresh for: 2 days 14 hr (20%), 6 days 11 hr (50%), 1 week 5 days (100%)). It has a validator present, but when a conditional request was made with it, the same object was sent anyway. It doesn't have a Content-Length header present, so it can't be used in a HTTP/1.0 persistent connection.

 

jamie




msg:1249076
 9:44 pm on Aug 25, 2005 (gmt 0)

aijohn,

if the last modified value is set, then search engine spiders and browsers know whether they need to fetch the page again, or whether they can display the cached version - this is very useful for regular visitors to the site and for search engine spiders: e.g.

you have a 10,000 page site, googlebot comes in, and without the last modified date, it doesn't know which pages have new content and which do not - so it spiders higgledy-piggledy. (i think with the new sitemap function of google's you could probably get round this, by having a separate script which updated the sitemap with all newly changed pages).

however, the more complicated the page gets - i.e. the more database calls and includes you use on each page - the more complicated it gets to work out the last modification time, this is why most big dynamic sites don't bother sending it.

we have a relatively big site and we refresh the last modified time every 6-12 hours,. depending on the page. that seems to me to be a good enough compromise between cacheability and ease of code.

hth

jd01




msg:1249077
 2:04 am on Aug 26, 2005 (gmt 0)

You could set the date in the DB when the information is updated and use that. Like this:

Insert this into a Col called moddate (or something) when you upload new or edited information:
$moddate = date("D, d M Y H:i:s")." GMT";

Then on the page:

DB connection and stuff here

$date = $yourvariable['moddate'];

// if the date matches - send a 304
if(isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $date) {
header('HTTP/1.1 304 Not Modified'); exit;
}
}

// if we did not exit, send a Last Modified Date
header("Last-Modified: ".$date."");

Justin

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved