How to specify a vary accept-encoding header Quickly-Gtmetrix Tips
How to specify a vary accept-encoding header in wordpress-
Why to specify a vary accept-encoding header in wordpress?
Gtmetrix explains Bugs in some public proxies that don’t support compression may lead to compressed versions of your resources being served to users . So to instructs the proxy to store both a compressed and uncompressed version of the web resources Specifying the Vary: Accept-Encoding
header is necessary.
How to specify a vary accept-encoding header in wordpress-Gtmetrix Tips ?
*Note download .htaccess file or copy code inside .htaccess file in your notepad to restore incase of failure
- Go to file manager in your hosting cpanel
- Locate your files here /public_html/.htaccess
- For multiple hosting website Locate your files here /public_html/website folder/.htaccess
- Now Add the following line of codes in your .htaccess file mostly at the Beginning or at the End inside .htaccess file:
If your server is Apache paste below code inside .htaccess file
<IfModule mod_headers.c> <FilesMatch ".(js|css|xml|gz|html)$"> Header append Vary: Accept-Encoding </FilesMatch> </IfModule>
If your server is Nginx paste below code inside .htaccess file
gzip_vary on
If your server is IIS paste below code inside .htaccess file
<system.webServer> <httpProtocol> <customHeaders> <remove name="Vary"></remove> <add name="Vary" value="Accept-Encoding"></add> </customHeaders> </httpProtocol> </system.webServer>
Now test your website in https://gtmetrix.com you will see your website has improved lot If you have any questions or problem with above task, please comment below. Thanks