Genom htaccess kan du styra hur länge filer och bilder ska cachas hos besökaren och därigenom kan du spara mycket bandbred och upplevde hastighet hos besökarna
Först ska styrningen av cachen slås på genom
ExpiresActive On
Därefter definerar du hur länge som är default tid.
ExpiresDefault "access plus 4 hours"
Det går att i .htaccess definiera hur länge respektive filtyp ska cachas innan den laddas om på nytt.
Tiden som anges är i sekunder, dvs 3600 = 1 timme
ExpiresByType text/html A60
ExpiresByType text/php A60
ExpiresByType text/xml A60
ExpiresByType text/css A60
ExpiresByType text/plain A60
ExpiresByType image/gif A3600
ExpiresByType image/jpg A3600
ExpiresByType image/jpeg A3600
ExpiresByType image/png A3600
ExpiresByType image/bmp A3600
ExpiresByType text/javascript A3600
ExpiresByType application/javascript A3600
ExpiresByType application/x-javascript A3600
ExpiresByType application/x-shockwave-flash A36000
Här får du massor med bra tips och trix hur du kan använda .htaccess-filen för att styra en websida.