Home > Web > Add an Expires Header to static components with mod_expires

Add an Expires Header to static components with mod_expires

August 16th, 2009 Leave a comment Go to comments

According to Yahoo’s Best Practices for Speeding Up Your Web Site,
adding an expires header to static components can improve web site’s performance greatly.
Here is the simplest way to add expires header.
Open .htaccess file, and append the code.

<IfModule mod_expires.c>
   <FilesMatch "\.(ico|gif|jpg|JPG|jpeg|png|swf|css|js|html?|xml|txt)$">
      ExpiresActive On
      ExpiresDefault "access plus 1 years"
   </FilesMatch>
</IfModule>

More details about mod_expires, please refer:
http://httpd.apache.org/docs/2.0/mod/mod_expires.html

  1. September 13th, 2009 at 21:34 | #1

    Thank you very much for this useful blog post.

  1. No trackbacks yet.