views:

37

answers:

2

If the server is automatically sending an Expires HTTP header response by default, can I override/null that out with a php script so that the Expires header field is not set?

A: 

The response containing a default Expires header depends on whether you're using sessions (and how, see session_cache_limiter)

Anyway, if it does, yes, you can override it and you can probably remove it with header_remove (I haven't tested it).

Artefacto
A: 

Yes you can. This will cancel any previously set Expires header from being sent:


header('Expires:');

It will only work if no headers have been sent already, so before you echo something and PHP starts sending data to the browser. You might have to use output buffering to do that.

And when you upgrade to PHP 5.3.* you could also use header_remove('Expires');.

bobdiaes