Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
01-25-2012, 10:56 AM #1
- Join Date
- Jan 2012
- Thanked 0 Times in 0 Posts
How to set the expiration date for static resources in a webpage?
i checked the page loading speed of my website from google page speed online and score out the 48 out of 100. This is a matter of worry for me. The checker tool show me the following errors: -
Leverage browser caching: -
When i go through this then this show me "Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network."
As the instruction's are given there and form some other article i set expiration date with following code
<meta http-equiv="expires" content="mon 01, jan 2013 00 00 00 GMT" />
but when i check its validation then it show me error of not valid value for http-equiv attribute and also the same error persist again. how i resolve it please help??
01-25-2012, 11:57 AM #2
- Join Date
- Mar 2006
- Splendora, Texas, United States of America
- Thanked 288 Times in 282 Posts
Presumably, you can do it on a per-file basis with PHP:
That's not very efficient though. There's probably a way to set it for all your files by default, but I don't know what it is.PHP Code:
header("Expires: Sat, 31 Jan 2099 00:00:00 GMT");
For every complex problem, there is an answer that is clear, simple, and wrong.