Five things to do to make your website 2X faster

GT Metrix Logo Header Image
31 December 2016

How to make website load faster

Whats better than a lightning fast website? Its a bad thing to make your website visitors wait because website loading speed of your website is lame. This blog post tells five simple tricks to make your website load 2x faster than it usually is.

Step 1:- Enable Server Caching
The first and important thing is to enable server caching. By enabling server caching we store cached files on temporay storage and provide that to user which speed up website speed.

<IfModule mod_expires.c>
       # Enable expirations
       ExpiresActive On
       # My favicon
       ExpiresByType image/x-icon "access plus 1 year"
       # Images
       ExpiresByType image/gif "access plus 1 month"
       ExpiresByType image/png "access plus 1 month"
       ExpiresByType image/jpg "access plus 1 month"
       ExpiresByType image/jpeg "access plus 1 month"
       ExpiresByType application/javascript "access plus 1 month"
       ExpiresByType text/html "access plus 2 days"
       ExpiresByType text/css "access plus 7 days"
       ExpiresByType font/truetype "access plus 1 year"
       ExpiresByType font/opentype "access plus 1 year"
       ExpiresByType application/x-font-woff "access plus 1 year"
       ExpiresByType image/svg+xml "access plus 1 year"
       ExpiresByType application/ "access plus 1 year"

Step 2:- Allow No Etags
Allow Etags to none and for that we have to add following to htaccess.

FileETag none

Step 3:- Enable Gzip Compression
The second step is allow gzip compression. Gzip is a method of compressing files for faster network transfers. Compression allows your web server to provide smaller file sizes which load faster for your website users and we can do that by add following code on bottom of htaccess file.

<IfModule mod_deflate.c>
       # Compress HTML, CSS, JavaScript, Text, XML and fonts
       AddOutputFilterByType DEFLATE application/javascript
       AddOutputFilterByType DEFLATE application/rss+xml
       AddOutputFilterByType DEFLATE application/
       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 text/css
       AddOutputFilterByType DEFLATE text/html
       AddOutputFilterByType DEFLATE text/javascript
       AddOutputFilterByType DEFLATE text/plain
       AddOutputFilterByType DEFLATE text/xml
       # Remove browser bugs (only needed for really old browsers)
       BrowserMatch ^Mozilla/4 gzip-only-text/html
       BrowserMatch ^Mozilla/4\.0[678] no-gzip
       BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
       Header append Vary User-Agent

Step 4:- Use Minified Css, Js, Html
The next step to make website load faster is to use minified css, js and html file. Minified files are smaller in size due to no indenting and spaces. There are many online tools and website to minifiy files and here are some quicklinks
For Css
For JS
For Html

Step 5:- Use Server Scaled Images The last step is to use server scaled images. Use SVG in most cases but if you cant find svg files. Also compress your images and for that you can use online compression tools. We stringly recommend:-

By Lakshay Jain

Tags: Cloud