The Last Modifies header field indicate the date and time at which origin server believe your file was last modified.
Last-Modified = “Last-Modified” “:” HTTP-date
Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
When any user comes first time at that time your browser will make number of HTTP requsets to download all the contents. With Expire Headers you can make those contents cachable for certain (defined) time, so for next it will load the content from the cache instead of making the request to server content.
Expire header should be applied to all static components including CSS, js, Flash files.
Be sure that you should not catch the content for more that one year, as its violets the RFC guidelines for Catching the content in browser.
Have you ever looked at Browser Response Header? You will see one thing which is eTag, Then What is this eTag?
eTag is the Entity Tags, an Unique identifier associated with the each resource of the site.
To turn of the eTag you can use below code in .htaccess fie.
When ever your browser make the request to the any resource, first it will check the eTag and if-match header to check the resource is modified or not since last it was cache.
You can see the Browser Response headers using Firebug Net Panel, Please have a look at the below image for the reference.
From my point of view you should do below to make the proper caching.
Use the expire header by setting the far expiration date.
If you have used the Expire Header then you should disable the Last Modified Header, This is because, some browsers are blocking the Last Modified Header if Expire Header is available.
If you have used the Expire Header then you should disable the eTag , reason is same as for Last Modified.
Let me know your suggestion by commenting here.
Avinash Zala currently working at a leading web development company as a Sr. PHP Web Developer. He is the founder of the Xpert Developer. He has completed B.E. in Information Technology. Born and brought up in Ahmedabad. He loves to code and coding is all about passion for him. Follow him on twitter at Avinash Zala & Xpert Developer.
View all posts by: Avinash