afshin.m Posted June 5, 2010 Share Posted June 5, 2010 Hi, I use this headers for my PHP file: header("Last-Modified: " . gmdate("D, d M Y H:i:s",filemtime("../cache/css/".$md5file.".css")) . " GMT"); header("Expires: " . gmdate("D, d M Y H:i:s", time()+(2592000)) . " GMT"); header('Cache-Control: public, max-age=2592000'); But when i check my website in FireBug, i get 200 OK response but i think this is should response 304 Not modified ...? See this details : [b]Response Header[/b] Date Sat, 05 Jun 2010 07:04:53 GMT Server Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 X-Powered-By PHP/5.3.1 Last-Modified Wed, 28 May 2008 21:02:26 GMT Expires Mon, 05 Jul 2010 07:04:53 GMT Cache-Control public, max-age=2592000 Content-Encoding gzip Vary Accept-Encoding Content-Length 408 Keep-Alive timeout=5, max=99 Connection Keep-Alive Content-Type text/css [b]Request Headers[/b] Host localhost User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept text/css,*/*;q=0.1 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Connection keep-alive Referer http://localhost/cache/test.php Cookie PHPSESSID=fnrlds14pqedj0s96mvasfqvo5 If-Modified-Since Wed, 28 May 2008 21:02:26 GMT Cache-Control max-age=0 And more about cache: Last Modified Sat Jun 05 2010 10:34:53 GMT+0330 (Iran Standard Time) Last Fetched Sat Jun 05 2010 10:34:53 GMT+0330 (Iran Standard Time) Expires Mon Jul 05 2010 10:34:53 GMT+0330 (Iran Standard Time) Data Size 408 Fetch Count 23 Device disk Is there any solution? Thanks. Link to comment https://forums.phpfreaks.com/topic/203939-expire-last-modified-header-problem/ Share on other sites More sharing options...
ignace Posted June 5, 2010 Share Posted June 5, 2010 If you want a 304 Not Modified reponse you need to write it otherwise it returns a 200 OK response. header('HTTP/1.0 304 Not Modified'); Link to comment https://forums.phpfreaks.com/topic/203939-expire-last-modified-header-problem/#findComment-1068117 Share on other sites More sharing options...
afshin.m Posted June 11, 2010 Author Share Posted June 11, 2010 Hi, Thanks ignace but when i use this header, content not loaded and returns 0 bytes of data. (For example CSS not loaded and i my website without CSS style) Link to comment https://forums.phpfreaks.com/topic/203939-expire-last-modified-header-problem/#findComment-1070722 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.