Some proxy servers still will not cache the CSS file if it contains a query string (the ?blah part)
For more information about that see this post: http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/ I wrote about this myself using the timestamp in the filename itself and mod_rewrite to rewrite the name to the actual file: http://www.electrictoolbox.com/force-reload-css-javascript-unique-filenames/ And finally, if you look at the source of the TradeMe website you'll see they do version the CSS and JS files e.g.: <link rel="stylesheet" type="text/css" href="/Styles/Homepage52.css" /> Whether or not they versioned in the filenames this particular change I can't tell, but I did notice on my laptop earlier this morning that the prices on the homepage were all over the place but when I looked again later on using my desktop it all looked OK. So there was either a caching issue for me or they've subsequently fixed some issues. Cheers, Chris 2009/7/6 Craig Anderson <[email protected]>: > > Hi. > But you have to change the headers for CSS files well in advance of a > rollout (generally months but depends on web server configuration), so > that all browsers (and transparent proxies) will actually connect to > the server to get/determine that the CSS file has changed. > > I'd avoid ever setting no-cache or must-revalidate on CSS files > because it slows down page loading and places unnecessary load on the > server. > > New filenames is probably the answer. > > Haven't used it for CSS before, but what about just adding something > like: > ?ver=9.9.9 > e.g.: > <link href="/mysite.css?ver=1.0.3" rel="stylesheet" type="text/css" > media="all" /> > to the end of the link URL and changing the version number on any > major CSS change? That way one can keep the same filenames but still > force the CSS to be reloaded. > -Craig > > On 6/07/2009, at 9:06 AM, Paul Bennett wrote: >> something like this? >> >> <?php >> header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 >> header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past >> ?> >> >> http://php.net/manual/en/function.header.php >> >> Would have to be added on a per-file basis and the server config would >> need to be altered to pass css etc through php first, but in theory it >> would work. >> >> Trademe is an MS shop though, but I'm sure similar tricks exist. >> >> Maybe it would have been better for them to shift to new stylesheet >> filenames for the new version of their site? This would have stopped >> the issue they seem to be facing... >> >> Paul > > > > > -- Chris Hope The Electric Toolbox Ltd Email: [email protected] Web: www.electrictoolbox.com Phone: +64 9 522 9531 Mobile: +64 21 866 529 --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
