WordPress: How to Fix the "Specify a Vary: Accept-Encoding Header" Warning

Solve Wordpress Specify a vary message

As many of you already know, I spend my dear, long day around customer websites that are usually based on WordPress. For this reason, today again a tip that I just learned myself when I checked the loading time of a website Tool from Pingdom controlled.

The website received the grade "A" (corresponds to school grade 1) everywhere, but a lonely "E" entry (school grade 5) with the message "Specify a Vary: Accept-Encoding Header". Incidentally, this message is not only available with the load time tool from Pingdom but also with other tests such as GTmetrix or Google PageSpeed ​​Insights.

The message "Specify a Vary: Accept-Encoding Header" is often found in the free Pingdom tool for measuring the loading time. It can be fixed in WordPress with a short entry in the htaccess file.

The message "Specify a Vary: Accept-Encoding Header" is often found in the free Pingdom tool for measuring the loading time. 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. And only ever changes this file via FTP program. There are WordPress plugins that allow changes to be made in 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 for that time. So work on it right away via FTP.

In order 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 WordPress block (above) but also an entry from a caching plugin. What we have inserted is only the block outlined in red below.

In my htaccess file there is not only the standard WordPress block (above) but also an entry from a caching plugin. What we have inserted is only the block outlined in red 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 at Pingdom again, there was now an "A" in the rating at the point where an "E" was previously to be found. Operation 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 or at Patreon would support.

Leave a Comment

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