Sometimes having too many visitors can cause your website’s monthly bandwidth to be consumed or even cause your server to crash. You never want something like this to happen to your website. You can optimize your website and work to keep it online for as long as you can to get around these problems. The following advice will help you optimize your website so that it loads more quickly and uses less bandwidth.
1. Gzip Compression
File compression and decompression are performed using GZip (GNU zip). Significantly better compression and lack of patented algorithms are its main advantages over compress. Enabling GZip compression will reduce the amount of data sent and speed up page display by compressing data sent from your Web server and having the browser decompress it instantly.
2. Add a Cache-Control or an Expires header.
Caches are used by browsers and proxies to decrease the volume and size of HTTP requests and speed up the loading of web pages. By using the Expires header, you can increase the number of static resources that the web browser caches and reuses without sending an additional HTTP request during subsequent page views.
- Browser Caching: Web servers use the Expires header in the HTTP response to inform clients how long any component may be cached at the user end. When someone visits your website for the first time, they must make several HTTP requests; however, by using the Expires Header, you make those components cacheable. On subsequent page views, this prevents needless HTTP requests. Use the expires header for all static resources, including CSS, PDF, Flash, scripts, and image(s). HTML is dynamic, so it shouldn’t be thought of as cacheable.
- Proxy Caching: When public caching is enabled for static resources in HTTP headers, the browser can download files from a nearby proxy server rather than the origin server that is farther away. It is possible to cache static resources on public web proxy servers, most notably those used by ISPs, thanks to HTTP’s proxy caching feature.
3. Block Hotlinks
4. Optimize and Compress Images
Images that have been optimized and compressed use less disk space and load more quickly for users. Many online tools for image optimization and compression are available for FREE. For you, optimized images are preferable. They are better suited for storage on your web server, email attachments, and web pages. You can also learn article below to speed up your ASP.NET website.
5. Combine Your Java Script & CSS Files
The number of HTTP requests can be decreased by combining all external Java scripts into a single Java script file and all CSS into a single stylesheet file. The secret to making your page load faster is to use fewer HTTP requests.
Example: Many website will have multiple Java Script files inside <HEAD> tag for different purpose.
<script src="https://www.example.com/menu.js"></script> <script src="https://www.example.com/ajax.js"></script> <script src="https://www.example.com/nav.js"></script> <script src="https://www.example.com/tools.js"></script> <script src="https://www.example.com/footer.js"></script> <script src="https://www.example.com/others.js"></script>
All the above six Java Script files can be combined in one Java Script file:
6. Avoid Images: Use HTML and CSS Instead
Use HTML and CSS instead of images whenever and wherever possible. For instance, you can use BGCOLOR as the background color and use CSS to give textboxes, DIVs, and other on-page elements a border, radius, and gradient effect. These extraneous images will eat up space on your web server and bandwidth when people visit your website.
Additionally, loading images can cause your website to load slowly. This is easily avoidable by making clever use of HTML & CSS.
I hope that this post will assist you in limiting bandwidth usage on your website for faster loading and a better user experience.
More advice? Please share your thoughts in the space provided below.