10 Tips for reducing web site bandwidth

cybrax

Community Advocate
Community Support
Messages
764
Reaction score
27
Points
0
When your site becomes succesful and the monthly traffic allowence for your web site is getting close to the limits but you don't want to upgrade just yet here are a few things that may help.

  1. Put all your javascript into external .js files. This means that they are stored in the visitors browser cache and re-used.
  2. Spread the load. Store bulky content such as images or attachments on external web sites such as Flicker or Google (free) sites.
  3. Optomise the code. Strip out the whitespace, comments and use compression tools such as Wordoff and Gzip.
  4. Use CSS for decoration and buttons. CSS is getting lots of new features, new browser releases will support them.
  5. Enable client browser caching if your web site is NOT dynamic.
  6. Outsource RSS feeds. eg: Feedburner
  7. Use Client side browser storage. Still relatively unheard of, why not take advantage of 5MB of storage space inside the visitors browser? Way better than cookies and more persistant.
  8. Use externally hosted AJAX and Javascript Libraries
  9. Go easy on the in page Javascript and Flash
  10. Prevent hotlinking and starve the leeches
Notes: If it looks like your web site content is being scraped regulary then you may also wish to take steps to prevent this as well.
 

c9311

New Member
Messages
11
Reaction score
0
Points
0
Here are a couple of .htaccess code blocks that can help you save bandwidth:
This one compresses your content.
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl|png|gif|jpg|js)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
This one sets how long files are ached for.
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 1 month"
</FilesMatch>


Also, if you use Firefox, try Googles Page Speed. It has a lot of handy details and improvements.
 
Last edited:
Top