Speed up your site with client side caching


Client side caching enables your visitors to cache your content to reduce waste on global network resources, including your own server’s bandwidth. This speeds up your site by reducing the load/requests.  Google rewards sites that make use of this.


WARNING:  Make a backup of your htaccess file first so you can revert to your working file in the event something goes wrong.

Add the following text to your .htaccess file:

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
#ExpiresByType text/css "access 8 days"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 8 days"
ExpiresByType application/x-shockwave-flash "access 8 days"
ExpiresByType image/x-icon "access 1 month"
ExpiresDefault "access 8 days"

# No caching
<filesMatch ".(css|php|html)$">
        Header unset ETag
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"

After setting the defaults above, you may wish to exclude certain specific files, like status.php that update for specific users. Please see the following ADVANCED setup examples.
Advanced Cache Control

Leverage Browser Caching

M3Server.com – WordPress Hosting Plans

Posted in FAQ and tagged , , .