Recently I have been working on a lot of different things on the website. It’s all in WordPress so it’s pretty easy to do from anywhere. When working on the site I keep an eye on numerous things in SEMRush as well as Google Search Console and some other places. I noticed that SEMRush couldn’t read my sitemap, but I could read it just fine at first. When I refreshed the page, though, it was just blank. I was in Chrome and figured maybe it’s some weird caching issue with the browser, but when I booted it in Firefox I saw that it was saying Content Encoding Issue.
What is a Content Encoding Issue?
Content encoding errors happen when there is a mismatch between how the server is compressing data and how the browser is trying to decompress it.
When a browser requests a page it tells the server what compression formats it can handle, usually gzip or Brotli. The server compresses the response and sends it back with a header telling the browser what format was used. If those two things do not line up, or if the content gets compressed twice by two different systems, the browser cannot decode what it receives and throws the content encoding error.
The most common causes specifically:
Double compression is the biggest one. PHP compresses the output with zlib, then WP Super Cache or Autoptimize compresses it again, then Cloudflare compresses it a third time. The browser gets something that has been wrapped multiple times and cannot unwrap it correctly.
A corrupted or misconfigured .htaccess file can send incorrect encoding headers, telling the browser to expect gzip when the content was not actually compressed.
PHP output buffering conflicts happen when multiple plugins or the theme are all trying to manage PHP output at the same time and one of them adds compression headers incorrectly.
Cloudflare’s compression running on top of WordPress compression is extremely common and often overlooked because people fix the WordPress side and the Cloudflare side keeps interfering.
A broken plugin that hooks into output and either strips the encoding headers or sends incorrect ones mid-page.
The short version is that something told the browser to expect compressed content and then delivered something the browser could not decode, usually because two systems were compressing at the same time. The question is though, how do we fix it?
PHP.ini or cPanel fix
The first thing I tried and this might have fixed it, if it wasn’t a WordPress site, is to go into cPanel’s MultiPHP INI Editor and turn off zlib.output_compression. If you don’t have cPanel, then you can turn it off inside your PHP.ini file. You should be able to do it right from your web host’s control panel, if not you’ll need to do it via Linux command line, assuming you have access.
The WordPress fix
Since that didn’t work, I figured maybe it was a compression issue somewhere else, so I started looking around in WordPress and found inside of WP Super Cache, there is this setting: “Compress pages so they’re served more quickly to visitors. (Recommended)”. Upon turning it off, I was able to see my sitemap again in Firefox and Chrome.
TLDR
Inside either cPanel or PHP.ini turn off zlib.output_compression. If that doesn’t work, go into your WordPress admin panel and turn off “Compress pages so they’re served more quickly to visitors. (Recommended)” in WP Super Cache.
