Creative web studio The art of online solutions Web development services site map | contact us | our vision   Graphics Designing
  Fast Designing
Home Karachi website designers Services Karachi website designers Services Freelancer for Hire Portfolio Pakistan web consultant About us Online business solution providers Contact us
Karachi Web developers
Navigation
Creative web solutions

Your Tech Guide and Tips | A Tech Blog from Fast Designing

Solution: How to Leverage browser caching to Improve Page Speed Score?

I was looking to improve my page speed score for one of my client website. Previously score was 92/100. I was getting a warning from Google Page Speed Tool:
"The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:..."
I search google and found an easy way to solve this issue.

Put this code into your .htaccess file and upload it:

<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 30 days"
</IfModule>
Header unset ETag
FileETag None
</FilesMatch>

Now, wait few mins, and recheck your Google Page Speed Score. You will see your Page Speed Score will be improved. My Google Page Speed Score improved and jumped to 98/100.

Please note: I have tested the above code on GoDaddy Hosting and it was working absolutely fine.


If you like this post you can start following me on twitter


  • Cosmin Tataru
  • Valeriob
  • Namita

    hiii

    I had put this code in htaccess but it showing internal server error
    wt i hv to do?

  • Dave

    internal server error

    • http://blog.fastdesigning.com/ Rashid Rupani

      Are you on a apahe/linux or on a windows server? May be your hosting company doesn’t support mod_expires module. That’s why you are having Internal Server Error.

  • Michael E.

    if you copy the code above, make sure to change the curly quotes to straight quotes prior to uploading – or you’ll get a server error.

  • Rafe

    Rashid, This code will not work as is, the colored fonts will, will place strange characters in the .httaccess file. Place this into a text file first to check. This is why will will not work if you simply copy and paste this code. ‘

    I would recommend you placing the exact code from your .htaccess file, this will avoid the strange characters or use the

     place code here 

    just my two cents.

    • http://blog.fastdesigning.com/ Rashid Rupani

      Thanks for the suggestion. I have installed “SyntaxHighlighter” plugin. Now users can easily copy paste codes.

    • Sonam Pawar

      i am suffering same problem

  • http://blog.fastdesigning.com/ Rashid Rupani

    On the request of users, I have installed “SyntaxHighlighter” plugin. Now you can easily copy paste codes from here.

  • James

    how do i save the code? RTF or html or as a text document?

    • http://blog.fastdesigning.com/ Rashid Rupani

      Just copy the code and paste it in your .htaccess file

  • Guillermo

    Well, it didn’t work for me D’: is there anything else we should know to get this working? :P

  • Pingback: Today (11-06-2012) I learned that… | Edventures in Normalcy

  • Pingback: Leverage Browser Caching in .htaccess File | Edventures in Normalcy

  • NTuneR

    Thanks this was exactly what I needed to know.

  • http://www.gauraw.com/ Kumar Gauraw

    Rashid,
    You just helped me get my speed jump from 72/100 to 84/100. Thank you brother. You are awesome!

  • http://www.facebook.com/bradc56 Brad Campbell

    I just went from 80-90 and pingdom with your tip. Thanks

    • http://blog.fastdesigning.com/ Rashid Rupani

      You’re welcome

Request InfoPrivacy PolicyTerms and ConditionsSitemapContact Us Request Info now
Copyrights to Fast Designing All rights reserved