Boost Up Website YSlow Score with Add Expires Header

Known

My website is a2fahmi.com based on WordPress

Page Speed Testing:

Tested using gtmetrix.com

Question:

How to add expires header on my website … ?

Answer:

Add this code inside .htacess file:

<IfModule mod_expires.c>

  ExpiresActive On
  
  # Images

  ExpiresByType image/jpeg "access plus 1 year"

  ExpiresByType image/gif "access plus 1 year"

  ExpiresByType image/png "access plus 1 year"

  ExpiresByType image/webp "access plus 1 year"

  ExpiresByType image/svg+xml "access plus 1 year"

  ExpiresByType image/x-icon "access plus 1 year"

  # Video

  ExpiresByType video/mp4 "access plus 1 year"

  ExpiresByType video/mpeg "access plus 1 year"

  # CSS, JavaScript

  ExpiresByType text/css "access plus 1 month"

  ExpiresByType text/javascript "access plus 1 month"

  ExpiresByType application/javascript "access plus 1 month"

  # Others

  ExpiresByType application/pdf "access plus 1 month"

  ExpiresByType application/x-shockwave-flash "access plus 1 month"

</IfModule>

Result:

Re-test again using gtmetrix.com and the “Add Expires headers Grade” increase from 0 to 56

Thanks for reading

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *