Leverage browser caching. Speeding up site.

Hello.

I try to speed up my site and this was a "tip" from google to do.:

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.

I have never heard of this before. can you help me?

Best Regards

Morten

  • Ash
    • WordPress Hacker

    Hello @Morten

    I hope you are well today and thanks for asking the question.

    Please try adding the following code at the top of htacceess:

    <IfModule mod_expires.c>
     ExpiresActive on
     ExpiresDefault "access plus 1 month"
     ExpiresByType application/javascript "access plus 1 year"
     ExpiresByType image/x-ico "access plus 1 year"
     ExpiresByType image/jpg "access plus 14 days"
     ExpiresByType image/jpeg "access plus 14 days"
     ExpiresByType image/gif "access plus 14 days"
     ExpiresByType image/png "access plus 14 days"
     ExpiresByType text/css "access plus 14 days"
    </IfModule>

    Please let me know if you find this is helpful, or if you have any further questions.

    Cheers
    Ash

  • Morten
    • Site Builder, Child of Zeus

    Thank you!
    Had to go on a noter pc to open it :slight_smile:

    Shall i just write it in over the <Ifmodule mod_revite.c> ?? or under that module?
    Or should i take away the first module?
    Sorry quite new to this :slight_smile:

    Best regards

    Morten

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.