user1406071
user1406071

Reputation: 627

Google PageSpeed - Setting an expiry date

I'm using a CentOS 5 32bit and I've just scanned my site on Google for page speed and it gave me the following:

"Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network."

Can someone please let me know how can I enable this within my Apache server?

Upvotes: 0

Views: 2172

Answers (1)

alan978
alan978

Reputation: 555

First ensure that mod_expires has been loaded then ,you can define in httpd.conf file or inside VirtualHost following:

   <IfModule mod_expires.c>
   FileETag MTime Size
   ExpiresActive on

   ExpiresByType application/javascript "access plus 1 week"
   ExpiresByType application/x-javascript "access plus 1 week"
   ExpiresByType application/x-shockwave-flash "access plus 1 week"

   ExpiresByType text/css "access plus 1 week"

   ExpiresByType image/jpg "access plus 1 month"
   ExpiresByType image/jpeg "access plus 1 month"
   ExpiresByType image/gif "access plus 1 month"
   ExpiresByType image/png "access plus 1 month"
   ExpiresByType image/x-icon "access plus 6 month"
   ExpiresByType image/ico "access plus 6 month"

   </IfModule>

Hope this helps !

Upvotes: 2

Related Questions