Specify a vary accept-encoding header
While checking your website speed in Google page speed, Gtmetrix and Pingdom tools, you may get advice to specify a vary accept-encoding header.
What is a vary accept-encoding header really means?
When a user request a page, browsers make a request to the server, they include HTTP headers for the server to decide what to send back.The Vary header describes what information "uniquely" identifies a request, caches should only be applied if the incoming request matches the Vary information in the cache.
To include the a Vary: Accept-Encoding header in WordPress, the below code should be added to the htaccess file.If you are using Yoast WordPress SEO plugin, then it will be real easy. Edit your htaccess file by navigating to SEO > Edit files section of the Yoast SEO plugin.
<IfModule mod_headers.c> <FilesMatch ".(js|css|xml|gz|html)$"> Header append Vary: Accept-Encoding </FilesMatch> </IfModule>
The above code includes a vary accept-encoding header by the Apache server.The vary accept encoding header code is different for Nginx,IIS and Litespeed servers.Make sure to have a back up copy of your htaccess file before adding this code.
Note : It's not possible to specify a vary accept-encoding header for Google analytics, Google fonts and Google adsense because of they are 3rd party resources.These files completely out of our hands and hosted from Google server.The same rule applies for leverage browser caching of Google adsense and Google Analytic's services.
If you are not using Yoast WordPress seo plugin,then log on to your C Panel using credentials provided by your hosting company.Find htaaccess file under file manager section then select edit and paste the code.Follow step by step procedure to edit your htaccess file.