Home SEO How to enable compression and gzip for page speed
How to enable compression and gzip for page speed

How to enable compression and gzip for page speed

Gzip is one of musts to have a faster website. If you are not using it for some reason, your webpages are likely slower than your competitors.

Compression allows your web server to provide smaller file sizes which load faster for your website visitors. Page speed is a ranking factor now, especially in mobile search! A faster site is always good for your visitors and SEO.

Enable Gzip/compression via .htaccess

mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

Enable Gzip/compression on Apache webservers

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
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

Enable Gzip/compression on NGINX webservers

gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;

Related posts

Write a comment

Sign up for our newsletters.

Do you want to see our new posts?

Enter your email below to get our latest posts! (NO SPAM!)