How to increase and improve your website performance

The website speed or page load time is a important factor to increase your website performance. Increasing the website speed is very critical today. It is not just to ranking high in Google and bing, but to keep your profits high. So today, I will cover and share all of the best ways that speedup your website and improve its performance.


Enable Browser Caching

Browser cache stores commonly used files from your website on your visitors browser and because of this it reduces the load on your web server. There fore it increases the page load times for repeat visitors.

How to enable browser caching via .htaccess file:

Create a .htaccess file in the root of your domain and add the below code in that file and save it. You can change the expiry dates depending on your websites files.

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
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 month"
ExpiresDefault "access plus 2 days"

Enable Gzip compression

In Gzip compression technique, it locates similar strings within a text file (css and html) and replaces those strings temporarily to make the overall file size smaller. Gzip compression reduce the size of files sent from your server by 70%. So you can feel the speed in your browser.

How to enable Gzip compression via .htaccess file:

In your .htaccess file, add the below code in that file and save it. You can change the expiry dates depending on your websites files.

<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 image/x-icon
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

Optimize your images

Keep your images as small as possible. Use png and jpeg image formats and avoid gif,bmp and tiff formats.Use photoshop or any other image manipulation software and save images for web to reduce the image size with good image quality. Avoid empty image src in the html codes.Always mention the src attribute in your coding.

Minimize the number of HTTP requests

If you have more HTTP requests in your page then it will increase the page load time. To reduce the number of HTTP requests, combine CSS files, merge Javascript files, and combine images in data sprites.

Disable hotlinking of images

Hotlinking means that other sites direct link to the images on your site and that makes your server load high. Use the below .htaccess code to disable hotlinking of jpg,jpeg,png,gif images. Here you can replace with your own domain. And you can replace the hotlinking of images with your own default image. Just change with your own image url.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ [NC,R,L]

Enabled KeepAlive

KeepAlive allow the same TCP connection for HTTP instead of opening a new connection for each new request. This helps to increase the page load time.Just add the below 3 line of code at your .htaccess file to enable keepalive.

<ifModule mod_headers.c>
Header set Connection keep-alive

Minify HTML, CSS and JavaScript

Minify is the process of eliminate extra spaces, line breaks, and indentation in your code. Just google about HTML, CSS and JavaScript minify and you will get lot of free minification tools.

Put your Javascript files to the footer

Place all your javascript files in the footer of your webpage.This allow browsers to start loading the content first and then it downloads the Javascript files.

Share NowShare on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPin on PinterestShare on StumbleUponShare on RedditEmail this to someone

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *