My goal
I would like to let browsers cache my whole website, but only download the new information when I have changed one or more files.
My situation
After some research I have found a way to do this. That is to add a Far Future Expires Header
to my htaccess file and add a querystring to my files using the filemtime()
function.
The problem
When I click on the address bar and type in my website address in firefox, then Firebug displays 38.3 KB (36.4 KB from cache)
When I press F5 in firefox, then Firebug displays:241.1 KB (10.9 KB from cache)
Now I have tried to do the same with Google and they are sending HTTP header 304 back. I have read a lot about ETag and the Last Modified header, but I have heard a lot of people saying that they are not really reliable.
My question
What would be the best solution if I would like to send HTTP header 304 back if the user presses on F5, like Google?
Update
It seems that Firefox is controlling the way the cache is used and I would like to use the cache also when a user presses F5.
Best Answer
As suggested @symcbean, and is the recommended practice to use unique URLs to avoid any problem with stale/new content. Anyway to eliminate the 304 requests remove the ETags and Last-Modified tag.
The URL below provides good tips for speeding/caching web pages.
http://www.askapache.com/htaccess/apache-speed-last-modified.html