.htaccessmod-deflate

Google Insights says enable compression for the page itself


I am on Apache 2.4

On the site I have enabled compression in the .htaccess file as follows:

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

Still, Google says, only for the main page, not for any of the loaded resources:

Compressing resources with gzip or deflate can reduce the number of bytes sent over the network. Enable compression for the following resources to reduce their transfer size by 29.2KiB (79% reduction). Compressing http://example.com/ could save 29.2KiB (79% reduction).

Does this refer to the html of the page, as I do not want to compress it? The reason I do not want to do that is that I am worried it will not look structured in View Page Source. For the same reason I have not minimized the HTML of the page.

Can you advise me on that, please?


Solution

  • Applying compression won't alter your document in any way. A lossless compressor, like gzip, will return exactly the same result after decompression.

    You might be thinking of a minifier -- these make changes without affecting the result, and would remove things like white space.