WordPress: How to Fix “Specify a Vary: Accept-Encoding Header” Warning

Solve Wordpress Specify a vary message

As many of you already know, I spend my whole day dealing with customer websites, which are usually based on Wordpress. For the reason today again a tip that I just learned myself when I was using the loading time of a website Tool from Pingdom controlled.

The site had received A grades (equivalent to grade 1) across the board, but a lone "E" (grade 5) entry with the message "Specify a Vary: Accept-Encoding Header." Incidentally, this message is not only available with the loading time tool from Pingdom, but also with other tests such as GTmetrix or Google PageSpeed ​​Insights.

In the free Pingdom tool for measuring the load time, the message "Specify a Vary: Accept-Encoding Header" can often be found. It can be fixed in Wordpress with a short entry in the htaccess file.
In the free Pingdom tool for measuring the load time, the message “Specify a Vary: Accept-Encoding Header” can often be found. It can be fixed in Wordpress with a short entry in the htaccess file.

What does this warning mean?

Basically, this message means that the server may be caching data, but isn't looking at the modern ones Browserthat support gzip compression actually get the compressed files. In the "worst" case, it could happen that an old browser is properly sent an uncompressed version of a file and this is cached on the server side. If a modern browser then comes by, it will also get the uncompressed data, which of course limits the performance when loading.

Inset - more interesting posts on the blog:

Fix via the .htaccess file

As always, my warning at this point: Before you work on the .htaccess file in the WordPress main directory, please make a backup copy. And changes this file only by FTP program. There are Wordpress plugins that allow you to make changes to the file via the WP admin area, but if something goes wrong, Wordpress and an editor are no longer available and the page remains white or throws an error. Then you can only undo the changes via the FTP program - and your website will be down until then. So it's better to work on it straight away via FTP.

To iron out the "error" with the "Specify a Vary: Accept-Encoding Header", enter the following lines of code at the end of your .htaccess file:

Header append Vary: Accept-Encoding

So it looks like this for me:

In my htaccess file there is not only the standard block from Wordpress (above) but also an entry from a caching plugin. But what we've included is just the red-framed block below.
In my htaccess file there is not only the standard block from Wordpress (above) but also an entry from a caching plugin. But what we've included is just the red-framed block below.

For you, however, it can look different, as you may not be using a security plug-in or caching plug-in that has already written additional things into this code. You can ignore that at this point.

After I ran the test again at Pingdom, the point where there was an “E” before was now an “A” in the rating. Surgery successful!

The end result after correcting the error is impressive: Lots of A-ratings should also be positively received by the Google Bot. ;-)
The end result after correcting the error is impressive: Lots of A-ratings should also be positively received by the Google Bot. ;-)

 

Did you like the article and did the instructions on the blog help you? Then I would be happy if you the blog via a Steady Membership would support.

Post a comment

Your e-mail address will not be published. Required fields are marked with * marked

In the Sir Apfelot Blog you will find advice, instructions and reviews on Apple products such as the iPhone, iPad, Apple Watch, AirPods, iMac, Mac Pro, Mac Mini and Mac Studio.