Can anyone explain this?
The Expires HTTP header contains the date/time after which the response is considered expired. Invalid expiration dates with value 0 represent a date in the past and mean that the resource is already expired.
Expires headers can help you control how different file types are cached and served to your visitors. They can not only help improve load times for returning visitors but also ensure they're only seeing fresh content. That's why they're important to website speed and the overall user experience.
If your web host uses the Apache web server, you can add Expires headers using the . htaccess file, which is located in the root folder of your server (the same folder that holds the wp-config.
Expires Headers are certain lines of code that tell your browser how long it should keep the cached files from your site. You can add Expires Headers by adding a code such as ExpiresByType image/jpg “access plus 1 month” to your site.
Generally used to prevent caching. However, this document will probably provide you with a better explanation:
http://download.oracle.com/docs/cd/E13158_01/alui/wci/docs103/devguide/tsk_pagelets_settingcaching_httpexpires.html
To quote:
Never use Expires = 0 to prevent caching. The Expires header is sent by the remote server and passed through to the browser by the Portal Server. Unless the time on all three machines is synchronized, an Expires=0 header can mistakenly return cached content. To solve this problem, set the Expires header to a fixed date that is definitely in the past.
How caching works (among other things) is that you send a header to the browser telling it when the page's content will expire. This means that if you send a header like:
header("Expires Sunday June 10th 2011"); // not correct timestamp
The content won't 'expire' until that date. The browser can then use caching techniques to serve the page locally from your browser instead of having to download all the content again.
When you set the expiration to 0, it ensures that the next time the browser loads the page, it will download the content, thus giving you up to the second data. However, as you might see from other answers, you shouldn't send 0 to prevent caching, but instead send a date that is in the past.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With