Login

My PHP Digest

Save Bandwidth and Loading Times

18th Mar 2007

The number one turn off for a website has to be loading times. If your server supports mod_expires you can improve your loading times by 66%, as well as saving your self bandwidth.

Page Loading Time
index.php - No Cache 1.03 seconds
index.php - Cached 79 milliseconds

As you can see from the results i recorded its a massive saving on page loading times, and if you check in FireBug my page loads in 31 milliseconds and the google statistics adds the other milliseconds.

The code

.HTACCESS
# Enable caching
ExpiresActive On
ExpiresDefault A86400

# 61 days
ExpiresByType image/png A5259487
ExpiresByType image/gif A5259487

# 28 days
ExpiresByType image/x-icon A2419200
ExpiresByType application/x-javascript A2419200
ExpiresByType text/css A2419200

# 3 days
ExpiresByType text/plain A259200
ExpiresByType text/html A259200

Its pretty simple to understand. The expire date is in seconds so what i done was use google. Example Here Hope it helps you, its helped me

© 2006 John's PHP Digest. All Rights Reserved