One of the most important things in SEO to get a good positioning of our website in search engines like Google, it is undoubtedly that the loading time, if they take too long to load, will be penalized by losing positions in search engines and therefore visits, Especially if the searches are done through mobile devices, where you need the pages are even lighter and load faster.
But it is not only important when it comes to SEO and positioning, but it is also important for our users to have a pleasant browsing experience that is not negatively altered by having to wait for it to load, or if you surf from A mobile device, will produce great consumption in its data rate.
That is why, you have already read in many places, the great importance of activating the compression of our website, to reduce loading times and therefore waiting without reducing its content, but what is not explained in those articles Is how to enable such compression on your server for this to work properly, since it is not enough to mark that option in WordPress or Joomla but also activate the option on the server.
How do we enable or enable gzip or deflate compression?
This activation is done by typing a few lines in our .htaccess file, which should be found in the root directory of our web page, as to which method is better, are more or less the same, although I have opted for gzip, Since Joomla is the default compression that allows you to activate, so it is obviously with which it will work better.
How to compress a web with gzip ?: Much simpler than compression with deflate, you will only have to copy in your .htaccess file, the following code:
# Gzip Compression if availiable
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_exclude mime ^ image /.*
Mod_gzip_item_exclude rspheader ^ Content-Encoding:. * Gzip. *
How to compress a web deflate ?: Well it is very simple, first we must choose if we want to compress the content of our website by file type or by extension, once chosen it is enough that you go to your .htaccess file and copy one of the 2 following codes according to the chosen method:
Compression deflate by file type:
# Deflate Compression by FileType
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 / atom_xml
AddOutputFilterByType DEFLATE application / x-shockwave-flash
Deflate compression by extension:
# Deflate Compression by MimeType
<FilesMatch "\. (Js | jpg | jpeg | gif | png | css | txt | html) $"> ExpiresActive on ExpiresDefault "access plus 1 month" SetOutputFilter DEFLATE
As you can see, gzip compression is much simpler and therefore recommended, also, if you look you will see that compression, video, image and sound are usually excluded from compression, this is because these files already contain a compression of their own , And we could not almost compress them, besides that in that attempt in vain to compress them, we would be using a very high amount of resources due to the size of these files, so it is not advisable, since in summary entails a very high consumption Resources and almost no benefits.
Anyway, I hope this article has been helpful, if so I hope you share an article link in your websites or blogs recommending it to those who might be interested. I await your comments, thank you for your visit and I hope you return soon.