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
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
- Log in into your control panel [cPannel or plesk] given by your hosting company. You will find the file Manager Folder.
- Go to file manager and search for .Htaccess file.
- If you do not have the .htaccess file you can create it by using New > file >file name .Htaccess options.
- After you found or created .Htaccess file click on ‘Edit ‘
- 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.
- Don’t miss a single dot or line from code to make it work.
- After pasting it click on ‘save’.
Code for enabling GZIP compression on Apache server.
Copy from # below.
|# TN START GZIP COMPRESSION|
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.*
# TN END GZIP COMPRESSION
Code for enabling GZIP compression on NGINX server.
gzip_buffers 16 8k;
gzip_disable “MSIE [1-6].(?!.*SV1)”;
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.
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 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.
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.
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.
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