How can I enable Leverage browser caching via .htaccess file?
Leverage browser caching – It is a simple method to reduce the page loading time of a website for regular visitors. This technique is useful to speedup pages for websites which has a high re-visit ratio by users. When a web browser loads a web page, it downloads all web file to load the page properly.
It includes HTML, images, CSS, scripts etc. Most of the pages include the same contents repeatedly. In this way we can really reduce the loading speed to a great extent!
Where I can enable this [Leverage browser caching] feature?
It’s basically an Apache module and this should be enabled by adding specific code to the Apache configuration file. Most of the users have only user level access to the server.
That’s the important of this post. Here I’m listing a code which can be simply added to the .htaccess file to enable this feature. The .htaccess is located in the public folder of your website.
Here is the code to add:
By using the above code, the main static contents such as images, CSS, PDF’s, JS, etc will be cached in web browser in order to produce faster loading time when you visit the site again.
The phpinfo() function in php has a lot of uses. Before going to disable the phpinfo function,you must learn the basics of it. Here is the link which helps you to create the phpinfo >> phpinfo() <<
What is phpinfo() function ?
The function phpinfo() displays the current information of PHP, which includes the php extensions and compilations, version, server information and environment (if compiled as a module), the PHP environment, paths, master and local values of configuration options, HTTP headers, and the PHP License etc.
I am using the same code and it’s simply awesome!!
Implement it and feel the change.
You want to be careful when enabling browser caching as if you set the parameters too long on certain files, users might not be getting the fresh version of your website after updates.