Enable .htaccess ExpiresByType Directives

Using Google Page Speed tools, one of the recommendations is to enabled Expire headers for Apache. The ExpireByType directives in your Drupal .htaccess file can set the duration which files should be stored locally. For example, if you set ExpiresByType for jpg files to 1 year, that means your file will not be re-downloaded by a user. The jpg file will be stored in the Temporary Internet Folder.

Put the following code near the top of Drupal's .htaccess file

ExpiresByType text/html "access plus 3 hours"
ExpiresByType image/gif "modification plus 1 year"
ExpiresByType image/png "modification plus 1 year"
ExpiresByType image/jpg "modification plus 1 year"
ExpiresByType image/ico "modification plus 1 year"
ExpiresByType text/js "modification plus 1 month"
ExpiresByType text/css "modification plus 1 month"


  • Faster load times for returning visitors
  • Reduced overall bandwidth, reduced Apache static file requests


  • Requires Apache's mod_headers and mod_expires
  • Not suitable for development servers. Turn off when publishing new CSS/JS