I’m investigating my website on GTmetrix and currently I’m working on this case:
To make it working, I’ve added this to the .htaccess
file which is located on the root of my project:
<IfModule mod_expires.c>
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"
</IfModule>
But still GTmetrix gives a score of zero to this case of my website. Noted that my website uses Linux ubuntu 16.04 OS an appache web server.
Any idea how can I do that?
2
Answers
I did it using following commands:
I am using following code, and it’s working perfect for me: