There are two aspects to this rule:
- For static components: implement “Never expire” policy by setting far future Expires header
- For dynamic components: use an appropriate Cache-Control header to help the browser with conditional requests
For rich interface websites for first-time visitor to your page may have to make several HTTP requests, but by using the Expires header you make those components cacheable. This avoids unnecessary HTTP requests on subsequent page views. Expires headers are most often used with images, but they should be used on all components including scripts, stylesheets, and Flash components.
Browsers user cache to reduce the number and size of the HTTP requests and making the page loads faster. A we server uses expire header in HTTP request to tell the client ( Browser ) how long a component can be cached.
[cc lang=”php”]
Expires: Thu, 15 Apr 2010 20:00:00 GMT
[/cc]
Above line will tell browser to cache the component in the HTTP request to until 15 April 2010.
If your server is Apache, use the ExpiresDefault directive to set an expiration date relative to the current date. This example of the ExpiresDefault directive sets the Expires date 10 years out from the time of the request.
[cc lang=”php”]
ExpiresDefault “access plus 10 years”
[/cc]
This trick works only if user have already visited your site once. This has no effect in performance if the user if visiting your website for first time using empty cache.
By using a far future Expires header, you increase the number of components that are cached by the browser and re-used on subsequent page views without sending a single byte over the user’s Internet connection.
Source : Yahoo Tips
[…] Contact « Expire Header | Cache-Control Header | Best Practice to Speed up your website […]
Valuable info. Lucky me I found your site by accident, I bookmarked it.
I really appreciate what you write about here. I try and check your blog every day so keep up the good work!
this really is def. 1 of the greater subject matter
I would like to stay in touch, What is your facebook page?
Nice post and this fill someone in on helped me alot in my college assignement. Thank you on your information.