Web Server Manual | Frames Format

To Search this page type CTRL-f or CMD-f key now.
To Search all pages, enter your question here:


Improving Your Web Wites Performance Through Better Caching
Below is an introduction to web page caching.

What is web page caching
Web page caching technologies built into your server can make your large, busy web site faster!

Advantages:

While web page caching is built into most web browsers, utilizing caching can improve your web sites perceived performance even further, while ensuring only the newest pages are viewed by the reader.

Question:
Have you ever visited a web site and then looked into your computers cache directory to find you just downloaded 1 megabyte of files?

Had the site used Server Caching that amount might have been reduced to 100 kilobyte!

If saving time and space on your viewers computers interests you please read on.


Server Caching?
HTTP headers give "you" control on how your pages are cached in a reviewing web browser.
HTTP headers are sent by the server before the HTML, and only seen by the browser and any intermediate caches.

Managing your web pages using HTTP headers is fairly simple.
The .htaccess file format, described in the Web Server FAQ section, can also be used to manage page caching.

  1. Review the sample .htaccess file, then return back to this page now.
    It may look complex, but it is simply a text file you place in your public_html directory, with many varied uses (password protection, page not found redirection, mime type setting, etc.).
  2. Take the sample .htaccess file above and save it to your local computer as a text file.
  3. Add the following text below to your .htaccess file. Notes:
    1. The "#" and text on the same line can be removed. This text is included to explain the line above it.
    2. You can be imaginative with this. Add or delete lines as necessary. For example, if you only wish to ensure .gif images are cached for 7 days then only include the ExpiresByType image/gif "access plus 7 days" line.
ExpiresActive On
# This line required.
ExpiresDefault "access plus 1 day"
# Tells the browser to expire all pages in 1 day, unless defined below.
# You can even set this to seconds using: ExpiresDefault M604800
# Above seconds setting will expire the page in one week of seconds.
ExpiresByType image/gif "access plus 7 days"
ExpiresByType image/jpg "access plus 7 days"
# If your images rarely change consider setting this to more days.
<Files index.htm>
Header append Cache-Control "public, must-revalidate"
</Files>
# This ensures the browser loads the "latest" index.htm page for example.

Other References:

Top Index