Fix GTMetrix Add expires Headers Error. GTmetrix is a popular website to measure website performance. You can fix GTMetrix Add Expires Headers error. GTMetrix / Gt Metrix is a free service to use. It measures even the minute details of website performance and interestingly it is free to use.
Must Read –
How to fix Random errors By Resetting WordPress completely to default settings.
How to Fix WordPress Right Sidebar while scrolling.
The best way to Fix Google Adsense Errors in AMP pages and help you generate more revenue.
Most of the Bloggers, especially the bloggers who use WordPress trust GTMetrix for measuring their blog’s stats.
I am sub dividing the article into two parts –
Steps to Fix GTMetrix Add Expires Headers Error in WordPress
Steps to Fix GTMetrix Add Expires Headers Error in WordPress
Scroll Down if the click does not work for you.
Steps to Fix GTMetrix Add expires Headers Error in WordPress
- Login to your WordPress Dashboard and go to Plugins section on Left side.
- Click Add New plugin and search for Yoast SEO.
- Hit install and follow the on screen instructions.
- Go to SEO section, click Tools and then File Editor (SEO » Tools » File Editor ).
- Select the .htaccess file and enter the below given code.
- Save and close the file and you are done to fix GTmetrix Add Expires Header Error.
Steps to Fix GTMetrix Add expires Headers Error in Blogger
- Login to your Blogger Website or blog.
- Now from your dashboard, go to Template and edit HTML.
- After you open the file in edit mode, paste the below given code.
- Save and close the file.
Important
Code for Blogger
<include path=”/assets/**.css” expiration=”7d” />
<include path=”/assets/**.js” expiration=”7d” />
<include path=”/assets/**.gif” expiration=”3d” />
<include path=”/assets/**.jpeg” expiration=”3d” />
<include path=”/assets/**.jpg” expiration=”3d” />
<include path=”/assets/**.png” expiration=”3d” />
The COde you need to enter for wordpress is below –
<IfModule mod_expires.c> # Enable expirations ExpiresActive On # Images ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" # Continue Blogcheater 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>
Sometimes, even after you place this code in your .htaccess file, then also you might get the same error in GTMetrix.
This might be due to any external java script. It could also be due to the Google Adsense code. But you should note that the errors appearing are less now. You can continue to use your WordPress blog now. I also recommend you to get a backup before you install the plugin and make the changes. Taking a precaution is always better