Archives
- March 2010 (1)
- February 2010 (1)
- January 2010 (2)
- December 2009 (1)
- November 2009 (2)
- October 2009 (5)
- September 2009 (1)
- March 2009 (3)
- February 2009 (1)
- January 2009 (2)
- October 2008 (1)
- September 2008 (5)
- July 2008 (1)
- June 2008 (5)
- March 2008 (1)
- January 2008 (1)
- December 2007 (5)
- November 2007 (8)
Categories
Blogroll
-
Vps Hosting
-
mfarney
Enable better caching on your website using PHP
Just a quick snippet to help you tell useragents accessing your site that the content hasn’t changed.
Then call this in the top of your code like this:
This sets an Etag based on the filename and modification date, and just returns a 304 header without any content if the browser already as the content.
You can also supply a different unix timestamp as the second argument allowing the timestamp to come from a database if applicable.
Hope this comes in useful!
Related Posts