» Control cache expire dates using htaccess
If you're running Squid to cache your website, you can use an htaccess file to control what kind of files should be cached, and for how long.
Prerequisites
First you should enable mod_expires, the Apache module that can control the Expire HTTP header in server responses:
a2enmod expires
htaccess
Next create a .htaccess file in your web root, containing:
ExpiresActive On
ExpiresDefault "access plus 4 hours"
ExpiresByType application/javascript A900
ExpiresByType application/x-javascript A900
ExpiresByType text/javascript A900
ExpiresByType text/html A90
ExpiresByType text/xml A90
ExpiresByType text/css A900
ExpiresByType text/plain A62
ExpiresByType image/gif A14400
ExpiresByType image/jpg A14400
ExpiresByType image/jpeg A14400
ExpiresByType image/png A14400
ExpiresByType image/bmp A14400
ExpiresByType application/x-shockwave-flash A3600
And that's it! Play around a bit with the values to suit your needs.
Like this article?
|
Then Digg it! Or use another bookmark button below to show your support & help me spread the word. |
Hot StuffFlaming articles» Survive heavy traffic with you... | RelatedArticles like this one» What's the deal with php_value... |
tags: squid, htaccess, virtual host, apache, mod_expires
category: How to - Webserver
read: 2,823 times






tagcloud
No comments. Be the first!