Thursday, July 1, 2010

How to enable expires header?

How to enable expires header?


For Apache web server you can add expires headers by adding following code in .htaccess file

<ifmodule mod_expires.c>
<filesmatch "\.(jpg|JPG|gif|GIF|png|css|ico)$">
ExpiresActive on
ExpiresDefault "access plus 7 day"
</filesmatch>
</ifmodule>


This tell apache web server to add expiry of 7 days to images, css and ico files, from time they are served.

When evaluating web application performance be sure that proper expiry headers are being sent from server.

No comments: