How to reduce website size to make it faster?

Hi visitors, If I ask you to wait for 20-30 seconds while the website gets loaded, will you?

I know your answer is big, No. No one likes to wait for longer to load the website, people shut that tab and bounce to another website in a few seconds.

So today we will look at how to reduce website size so the website can load in a better time.

How to reduce website size

We need to understand website includes various elements in its file size such as HTML files, CSS, JavaScript, Images and other media files.

So if you want to reduce total website size you need to take control over the size of these elements and in result, your total website size will come under your control. 

In the image, you can see my website size is 3.9 MB, at the ok level. So I am telling you a way to reduce and control website size. Take look and follow the steps.

Reduce website size with GZIP compression

Enabling GZIP compression on the website is the easiest way to reduce file size on the server. Even non-technical person will able to do this if they follow our tutorial. GZIP will compress your all website files and make your website faster than before.

So to enable a GZIP compression on the website you need to follow the following steps

  1. Log in into your control panel [cPannel or plesk] given by your hosting company. You will find the file Manager Folder.
  2. Go to file manager and search for .Htaccess file.
  3. If you do not have the .htaccess file you can create it by using New > file >file name .Htaccess options.
  4. After you found or created .Htaccess file click on ‘Edit ‘ 
  5. Copy below code into your htaccess file and if you have some codes already in the htaccess file you need to paste this code one line below of that code.
  6. Don’t miss a single dot or line from code to make it work.
  7. After pasting it click on ‘save’.

Code for enabling GZIP compression on Apache server.

Copy from # below.

# TN START GZIP COMPRESSION

<IfModule mod_gzip.c>

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.*

</IfModule>

# TN END GZIP COMPRESSION

 

Code for enabling GZIP compression on NGINX server.

Code:

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;

Also check – How to do ON page SEO

I will suggest you to take backup of Htaccess file before pasting this code. It will save you if place code in wring place.

While placing code please make sure you do not cut already an existing code in the htaccess file. You need to carefully install the code below the existing code.

More tips to reduce website Size. 

After enabling GZIP compression your website size will be reduced definitely avoid using by 50%.

If you need to reduce more you can follow below tips. Always remember one thing only uploading content on your website is not a way to get success, you need to provide a better user experience on your website.

If you provide a better experience people will remember your website as a brand. 

Image compression

Compress images while uploading it or use free image hosting platforms to host images and use those images on your website via the link.

Minify JavaScript

Minify JS, HTML for speedup website and reduce website size. You can do it with technical knowledge or you can hire professionals who will do it for you.

Caching

Enable browser caching for loading your website faster on user’s browsers.  Browser catch will save elements from your website into browser catch and use it to load website faster next time.

Unused plugins

If you are using Word Press CMS you can reduce website size by deleting unused plug-ins as well as themes.

Delete duplicate and unused images from website gallery.

Conclusion   

Dear users, I hope this htaccess trick will reduce your website size which will lead your site towards faster loading. Follow other tips and try to get CSS, JS, HTML minified by any professional. 

If you have any queries or suggestions then mention them in the comment box.

Author – Rahul Agarwal

Avatar
About Bhupender Saini
Bhupender Saini is a professional content creator and founder of 'Growmeup.' He is fond of writing and provides information to the visitors.

Be the first to comment

Leave a Reply

Your email address will not be published.


*