PHP session_start() overwrites HTTP Expires header
Asked Answered
P

1

2

I am trying to set Expire header to 2 hours from access for text/html by using mod_expires like that:

<IfModule mod_expires.c>
   ExpiresActive on
   ExpiresDefault "access plus 2 hours"
   ExpiresByType text/html "access plus 2 hours"
</IfModule>

However when used with PHP:

session_start();

Expires header is being reset to:

Expires: Thu, 19 Nov 1981 08:52:00 GMT

Any ideas how to avoid that overwrite by session_start()?

Pachydermatous answered 23/12, 2010 at 17:30 Comment(0)
P
7

OK, looks like have found an answer:

session_cache_limiter('public');
session_start();

does the trick, thanks.

Pachydermatous answered 23/12, 2010 at 17:37 Comment(1)
or pass an empty string to entirely stop PHP from screwing around with your caching headers.Haemolysin

© 2022 - 2024 — McMap. All rights reserved.