* Thus wrote Florin Andrei: > > I would like to continue to use PHP for my website, but somehow "fool" > the Web clients into believing they're seeing "true" static content. > Since the content changes rarely (like once every other month), there is > no harm in pretending it's "true" static content. > > I suspect there are quite a few things that can be done to achieve that > goal: > 1. change extensions to .html even though they're PHP files (i know how > to trick Apache into doing that) > 2. don't send HTTP headers that indicate dynamic content
1. wont do anything as far as the client is concerned. 2. should be worded as 'Send HTTP headers that indicates static' In truth, the browser has no clue if its static or dynamic, all it knows is wether it can cache the page or not. If you're using sessions in your pages then php is going to instantly send these headers (by default): Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Ensuring that no caching is going to happen. If you make php send a Expires in the future (ie 5 days) and turn off the deny caching directives, you're browser (depending on its settings) will cache the document, in most cases, for the lifetime of the browser window being open. Now after they close the browser (or force a reload) things get more complicated :) When you request a page, after time has passed, the browser will generally check the cache first: 1. if expires in the future just show the cached document This can be bad because in reality, and in your situation, the page may have been modified, and the user wouldn't see the changes. 2. Request from the server to see if the document has changed. But in order for it to do that it must have some information about the document: Last-Modified and Content-Length (headers) or the etag (a uniq identifier passed in the headers usually from the webserver). If the client requests a file only if its been changed (sending special headers), you're script is going to need to determain if the changes occured or not. if the latter, then you will simply send a response code 304 and exit your script. otherwise you send the file to them. Now, if you're willing to have you php script handle all the above (and more) its possible to make you're php script look identical to html static docs. The alternative to doing all that, is to generate the static files (html and all) on the file system, reference those documents instead of the php scripts and let apache deal with all the headers. All the information above can be found in section 13 of rfc2616 http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc2616.html#sec-13 Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php