Joomla 1.5: enabling Google and browser cache |
| Tuesday, 13 January 2009 | ||||
|
I just noticed upon launching a new domain powered by Joomla 1.5 that HTTP headers are designed to prevent caching and force the client (be it some crawler, robot, such as Googlebot, or a regular visitor's browser) to always request the page from the server. This is of little use if your articles are not changing over time. Forcing the client to request from server is good for sitemaps, or pages with ever-changing hot news. After some digging i came up with the modifications needed to allow document caching and set the Expires HTTP header. Alternatively, this can be done by adding HTML meta tags, which provides more granularity. This core hack would probably serve old content when ajax requests are made, unless the xmlhttp javascript takes care of forcing the request or adding a random variable in order to generate an unique url for every request. So, if you want google and your users to cache your joomla pages, go to libraries/joomla/document/document.php and, around line 779, change this line JResponse::setHeader( 'Expires', gmdate( 'D, d M Y H:i:s', time() + 600 ) . ' GMT' ,true); to // TMJ MOD JResponse::allowCache(TRUE); // JResponse::setHeader( 'Expires', gmdate( 'D, d M Y H:i:s', time() + 1209600 ) . ' GMT' ,true); 1209600 means 3600 seconds(1 hour) * 14 days, which is 2 weeks valability for your documents. You can change that to suit your particular needs, just remember that the validity is expressed in seconds.
Hello, Write Comment |
||||
| Last Updated ( Tuesday, 13 January 2009 ) | ||||
Joomla stuff
Newsletter
Auto tags
joomla browser caching
joomla expires header
joomla browser cache
powered by joomla 1.5
"powered by joomla! 1.5"
joomla add expires headers
"Powered By Joomla 1.5"
joomla Use Browser Caching
Add Expires headers joomla
joomla 1.5 cache
Leverage browser caching joomla
joomla expires
expires headers joomla
joomla expires headers
joomla caching
joomla browser
joomla cache expiration
use browser caching joomla
Expires header joomla
joomla leverage browser caching
browser caching joomla
joomla google cache








