I am attempting to enable Expires headers for images as suggested by YSlow. I am i had this working before however after i check YSlow it states they aren't being cached.

For my .htaccess, I've attempted:

ExpiresActive on
ExpiresDefault A0
<FilesMatch "\.(gif|ico|jpg|png)$">
    ExpiresDefault A29030400
    Header append Cache-Control "public"


ExpiresActive on
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"

http://www.seoconsultants.com/tools/headers.asp results the next for just one of my images:

HTTP Status Code: HTTP/1.1 200 OK
Date: Mon, 05 Oct 2009 20:12:04 GMT
Server: Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 PHP/5.2.8
X-Powered-By: PHP/5.2.8
Set-Cookie: PHPSESSID=5d11f4d8aa37ceee6605786e59ff4f0f; path=/
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
Set-Cookie: lastlogin=1254773024; expires=Mon, 02-Nov-2009 20:12:04 GMT
Connection: close
Content-Type: image/jpeg

The Set-Cookie part looks correct however the Expires header isn't. How do you set Expires properly and so why do they differ? I've double checked that mod_expires and mod_headers are enabled.

In the Set-Cookie header, it appears such as this is a component of the php session. php instantly hinders caching following a session_start().

You are able to modify this behavior by altering session.cache_limiter inside your php.ini. See the PHP manual page for that various configurations.

Alternatively, you could attempt using "set" rather than "append" to override the headers inside your .htaccess.