Page is a not externally linkable
jdMorgan - 2:45 am on Aug 12, 2004 (gmt 0)
To have your server serve a "cached" file if available, and call your script to generate a new file if a cached version is not already available, you have to use a script, yes. That script can be built into your existing one, or you can write another one. You could do it in .htaccess, PERL, PHP, or several other scripting languages. It boils down to: This could be as simple as something like this in .htaccess using mod_rewrite: The above code is meant only as an example only, so please take it as such. Jim
> I have to use a software (script) based cache system to have my pages cached for everybody.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(page_name)\.html$ /script.php?page=$1 [L]
and the only change needed to your existing script is to save its output to a file called "page_name.html" in addition to sending it back to the client as it does now. You would also need to come up with a plan to delete these "cached" pages periodically or whenever their contents are updated, in order to let the script generate the new version.
Brought to you by WebmasterWorld: http://www.webmasterworld.com