- Joined
- Apr 15, 2016
- Messages
- 612
- Points
- 28
I read a blog post and they are guiding to add Expires header to end of .htaccess file
As they are saying, this will take advantage of browser caching and minimizing HTTP requests to the server by using static files such as images, css, javascript stored in the browser cache when you visit the website for the first time. My question is, do I really need to add these codes into my htaccess file?
Thanks in advance.
Code:
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
Thanks in advance.