Enable browser cache and gzip compression to htaccess
Now we are going to learn how to create browser caching in .htaccess file, here in the below code we are simply adding the type of the file needs to be cached,you all think why we need to add this type? simple when a user access particular web page which loads very fastly in most website,it’s all because browser caching instead of loading each and every image and filetypes like css,js and videos we can add all these types in caching to increase website load performance.
In below code we are adding expires time to each and every type we added in the above code,here A31536000 indicates A for Access and numeric code indicate time for expire, and also we can add as below.
ExpiresByType text/css “access 1 month”
In the above code we can change the expire time 1 month by replacing “Month” to “Year”.
Here in the below code we are enabling the gzip compression in apache web server.
Here the below code do all the matching files,unset the header cookie.
Thanks for reading this article