Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Location
    India
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to set the expiration date for static resources in a webpage?

    hello friends,

    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??

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,387
    Thanks
    32
    Thanked 288 Times in 282 Posts
    Quote Originally Posted by skseofleet View Post
    how i resolve it please help??
    This needs to be done on your server. I'm not sure what the best way to do it is.

    Presumably, you can do it on a per-file basis with PHP:

    PHP Code:
    header("Expires: Sat, 31 Jan 2099 00:00:00 GMT"); 
    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.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •