How to solve “Add Expires headers” of GTMatrix for websites?

When we were checking our website using GTMatrix we got a very poor score from GTMatrix. One of the matrices was this “Add Expires headers” where got F sadly.

Following are the complains:

https://static.com/wp-content/cache/minify/3f101.css
https://fonts.googleapis.com/css?family=Open+Sans%3A400%2C600&ver=5.3.2
https://static.com/wp-content/cache/minify/6ce23.css
https://static.com/wp-content/cache/minify/0f1b5.js
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
https://connect.facebook.net/en_US/sdk.js
https://static.com/wp-includes/js/wp-emoji-release.min.js?ver=5.3.2
https://static.com/wp-content/cache/minify/dfacc.js
https://static.com/wp-content/cache/minify/3f9ed.js
https://static.com/wp-content/cache/minify/70cb8.js
https://adservice.google.com/adsid/integrator.js?domain=static.com
...
...
...

This above issues can be easily resolved by using .htaccess file. Inside the .htaccess file if we add the following line and check again then you will see a significany improvement:


  ExpiresActive on

# Your document html
  ExpiresByType text/html "access plus 0 seconds"

# Media: images, video, audio
  ExpiresByType audio/ogg "access plus 1 month"
  ExpiresByType image/gif "access plus 1 month"
  ExpiresByType image/jpeg "access plus 1 month"
  ExpiresByType image/png "access plus 1 month"
  ExpiresByType video/mp4 "access plus 1 month"
  ExpiresByType video/ogg "access plus 1 month"
  ExpiresByType video/webm "access plus 1 month"

# CSS and JavaScript
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType text/css "access plus 1 year"

https://stackoverflow.com/questions/13972629/add-expires-headers/