apache tutorial - How to configure caching with the mod_expires module - apache - apache web server - apache server - apache2
Using the mod_expires module
- Apache's mod_expires module enables you to define expiration intervals for different types of content on your web site.
- The following sample .htaccess configuration demonstrates how to do this:
- There are actually two ways to define expiration periods.
- You can specify an expiration period from the time the browser accesses the file by using the access keyword.
- Alternatively, you can specify an expiration period from the time the file was last modified on the server by using the modification keyword.
- The ExpiresDefault directive is an optional directive that specifies the expiration period for all other types of files not explicitly set in an ExpiresByType directive.
- To verify your expiration settings in the .htaccess file are working correctly, you can examine the raw HTTP headers sent between the browser and web server. (To do this, use a browser plugin that displays the raw headers such as Live HTTP headers for Mozilla Firefox, or the Developer Tools feature in Google Chrome.)
- When content is marked for expiration, Apache adds the following lines to the HTTP response header (the exact values will vary based on your own .htaccess settings):