Site icon Search Engine People Blog

How to Save Your Website(s) Bandwidth

At times too many visitors coming to your website can eat-up your website monthly bandwidth or even your serve may go down. This is something you don't want to happen to your website ever. To overcome these issues, you can optimize your website and try to keep it up and online as long as possible. Below are some tips you can use to optimize your website to load faster and save your bandwidth.

GZip: Compress HTML, JavaScript & CSS

GZip (GNU zip) is used for file compression and decompression. Its main advantages over compress are much better compression and freedom from patented algorithms. With GZip compression enable it will compress data being sent out from your Web server, and have the browser decompress this data on the fly, thus reducing the amount of data sent and increasing the page display speed.

Add an Expires or a Cache-Control Header

Browsers and Proxies use a cache to reduce the number and size of HTTP requests, making web pages load faster. By using Expires header, you increase the number of static resources that are cached by the web browser and are re-used on subsequent page views without making a single HTTP Request.

  1. Browser Caching: Web servers use the Expires header in the HTTP response to tell the clients how long any component can be cached at user end. Any first time visitor on your website has to make several HTTP requests, but by using the Expires Header you make those components cacheable. This avoids unnecessary HTTP requests on subsequent page views. Use expires header for all static resources like image(s), script(s), CSS, PDF, Flash etc. (HTML is not static, and shouldn't be considered cacheable)
  2. Proxy Caching: Enabling public caching in the HTTP headers for static resources allows the browser to download resources from a nearby proxy server rather than from a remoter origin server. HTTP provides for proxy caching, which enables static resources to be cached on public web proxy servers, most notably those used by ISPs.

Block Hotlinks

Hotlink protection can save you lots of bandwidth by preventing other websites from displaying your images. To prevent hotlinking add the below code in your .HTACCESS file.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+.)?example.com/

[NC] RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*.(jpe?g|gif|png)$ /images/troll-face.bmp [L]

Check this video tutorial for Hotlink Protection.

Optimize & Compress Images

Optimized & compressed images take up less disk space and load faster at user end. There are many FREE online tool available to compress and optimize images. Optimized images are better for you. They are more suitable for web pages, email attachments, or even storage on your web server.

Combine Your Java Script & CSS Files

By combining all external Java Scripts into a single Java Script file, and similarly combining all CSS into a single Stylesheet file, will reduce the number of HTTP requests. Reducing the number of HTTP requests in your page is the key for faster web pages.

Example: Many website will have multiple Java Script files inside <HEAD> tag for different purpose.

<script src="http://www.example.com/menu.js"></script>
<script src="http://www.example.com/ajax.js"></script>
<script src="http://www.example.com/nav.js"></script>
<script src="http://www.example.com/tools.js"></script>
<script src="http://www.example.com/footer.js"></script>
<script src="http://www.example.com/others.js"></script>

All the above six Java Script files can be combined in one Java Script file:

<script src="http://www.example.com/combined-all.js"></script>

Avoid Images: Use HTML and CSS Instead

Whenever and wherever its possible use HTML and CSS instead of images, example for background color you can use BGCOLOR and with CSS you can also give gradient effect, shadow effect, radius and border to on page ojejects DIV's, textboxes etc. These unnecessary images will take up your web server space and also will eat your bandwidth when users are visiting your website.

Images also take time to load, which can make your website to load slowly. This can be easily prevented by using HTML & CSS cleverly.

If you liked this post, you might also enjoy Increase Web Page Speed: Optimize Your JavaScript