Slow site speed is a headache for site owners. If your site taking much time to load then you will loose your customers and business. Recommended site loading time is 2 seconds. If your site taking more than 2 seconds then your bounce rate would be high. Your visitors will leave your site. And if you visitor leaves your site because of bad performance then it will be very less chance he will visit again in future. So question is, How to improve site performance?
There are a lot of factors which can help you in improving site speed. I am not going to discuss each tool. As it is a quick post, I will discuss 3 steps which help you to increase site performance.
Below are the 3 steps you should apply. It will give you better results in terms of performance.
- gzip Compression
- Leverage Browser Caching
- Image Optimization. Read our post TinyPNG Compress Images Using PHP
Enable gzip compression
Compression allows your web server to provide smaller file sizes that load faster for your website users. Compression of your HTML and CSS files with gzip typically saves around 50% – 70% of the file size. This means that it takes less time to load your pages. Add the below code in your htaccess to enable compression.
<IfModule mod_deflate.c> # Compress HTML, CSS, JavaScript, Text, XML and fonts AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml </IfModule>
Leverage browser caching
When you leverage browser caching, your webpage files will get stored in the browser cache. Your pages will load much faster for repeat visitors. Add the following code in htaccess and it will enable you browser caching.
<IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" </IfModule>
Image optimization
Image optimization plays important role in site performance. Heavy images makes the site speed down. There are lot of tools available to optimize images. But i prefer TinyPNG from which i get a better result. If you have a WordPress website then you can use plugin provided by TinyPNG. If you don’t use WordPress then you can refer our tutorial TinyPNG Compress Images Using PHP
I hope you understand how to improve site performance. For any questions and thoughts please leave comments below.
If you liked this article, then please subscribe to our YouTube Channel for video tutorials.