views:

222

answers:

1

I have XAMPP (latest version) installed on my Mac OS 10.6.3

I've added the following to .htaccess because I want .html to be interpreted as PHP.

AddType application/x-httpd-php .php .html

The problem is that the default XAMPP config seems to be caching .html files as static... so even though the PHP statements inside are being called (for example, 'echo time()' in index.html displays the dynamic output)... the actual file is being cached.

When I make changes to a .html file, I've having to restart Apache for it to load the newest changes.

Looking at httpd.conf, it looks like it's loading the following cache mods..

LoadModule file_cache_module modules/mod_file_cache.so
LoadModule cache_module modules/mod_cache.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so

Any idea how to implement a system whereby it checks the timestamp of the file, before loading it from cache?

Thanks!

A: 

I am afraid I have no answer as far as XAMPP configuration but I can suggest including PHP headers.

header('Content-type: text/html; charset=utf-8');
header('Expires: Mon, 20 Dec 1998 01:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').'GMT');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');

Not sure how a system to check the file last editted timestamp would help as PHP files are generally generate dynamic content and this timestamp has no correlation to database updates.

bigstylee
Unfortunately that doesn't help, because the caching is *server-side*, not through the browser.
Lee