To satisfy your visitors and get the maximum appreciation from them, you need to optimize your web pages and make a fast website. Google crawlers can easily find your content, and you’re helping yourself to get indexed easier than with a slow website. But sometimes, people forget or even neglect some easy tasks that can make their websites fast in a few seconds and best of all, it’s in your hosting account. Today I’ll show you how to how to compress website in cPanel.
It’s the Gzip method that speeds up blogs and website, and it’s not specified for WordPress or any other platform, it’s general, for any hosting account with cPanel.
Why do you need to compress your web pages?
The main reason to enable Gzip function or to create it, is to reduce the loading time. The HTML and CSS code include many white spaces and not optimized lines which make a web page loads slowly for a long time that the browser takes to download the data associated with every request. The good news is that you can reduce the downloaded data from your server by 70% in the majority of cases.
Read also: How to speed up a WordPress website.
In the compressed case, the browser requests your pages, including, their HTML and CSS codes, and it gets them compressed. That means faster loading time for your website, this is why compressing your website is not an option in our days, but a way to succeed.
The other big benefit to use Gzip and compress your web pages is to save bandwidth. This works perfectly for people who don’t use a CDN to speed up their sites. If you have a limited and little bandwidth limitation, you will save the majority of your regular bandwidth, remember that you will reduce the data size, that will work between the server and the browser by 70%.
Now, let’s compress your website:
The first step is to login to your cPanel, and find the icon ”Optimize Website”, under Software/Services section as the screenshot below:
The next step is select the option “compress all content” and save the settings. You can also, compress only any type of content you want, such as text/Html etc… But the ideal way is to compress all the content. That will never have any negative impact, but, it will reduce the time that the browser downloads the content from the server.
Now your server will send compressed data to any browser. As you can see, it’s only an option included in your cPanel account that you can use.
What if You don’t have the Gzip option in cPanel?
If for any reason you don’t have cPanel as your website hosting management account, and you have the NGINX web server, you can add the below code to your htaccess file:
gzip_buffers 16 8k;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
For Apache server, you need to add the below code in the htaccess file:
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.*
Now, you will see a better page speed and loading time. If you have an old hosting server with outdated Php and version, then, you should think about a modern hosting server, to be able to compress your site files and optimize your pages for better loading time.