On the Basic Options tab, in the Miscellaneous Settings, there's a button labelled . Clicking this button will add codes to the .htaccess file at the root of your site (on an Apache server) that directs the browser to cache static resources served from the server.
These codes are added actually when the plugin is installed so most likely you don't have to do anything. However you can click the button to ensure they are installed. You should get either of the following messages:
- Codes for 'leverage browser caching' already exist in the .htaccess file.
Tha plugin had already put the codes in the file. Most likely from a previous installation. You can FTP to the file to view and check that the codes are indeed there.
- The codes for 'leverage browser caching' were added to the .htaccess file successfully.
The codes were added to the .htaccess file in the root of the site as shown above. Static files should now be cached by the browsers.
- The plugin failed to add the 'leverage browser caching' code to the .htaccess file.
For some reason the attempt didn't work. Most likely due to permissions issue and the pluign couldn't write the codes to the file. This would require further exploration and troubleshooting to determine the reason why. For this the recommendation would be to submit a ticket with admin access to the site and FTP login to the server.
- An .htaccess file could not be found in the root folder of this site.
You do not have an .htaccess file at the root of your site. You will need to manually add one or perhaps there's one there but has the '.txt' extension appended to it rendering it as a text file. Rename the file to .htaccess so it can be used and configured.
The codes in the .htaccess file will look like the ones shown below. Please note that these codes will be removed on uninstallation of the plugin as part of the clean up procedure.
Codes in .htaccess file for browser caching.
I'm still seeing this error after updating .htacces. If you're seeing this error on your gtmetrix.com or PageSpeed report after adding these codes then check the details to view the actual files that are triggering this rule. If the files are from your server then you need to check with your host to verify if the mod_expires module is installed and enabled. This now becomes a server issue and we are not able to provide support on this.
Since these files are served from external servers then the codes in your .htaccess file or your server's configuration have no effect on them. Unfortunately there's nothing more the plugin can do to address this. Notable examples are Google Analytic files, Google Maps files, and files from social media application. You must now determine if you need to load these applications on your landing pages to further optimize your site.