WordPress Code Snippets

A fresh mix of code snippets and tutorials

Additional file-types for mod_expires

119

Here is a list of the most common file-types for Apache’s mod_expires, which is used for configuring expires headers.

As a general rule, set expires headers for a month or longer (up to one year) for static resources. For resources that change frequently, specify an expires header for a much shorter amount of time, like one second or one hour. That said, here is the list:

ExpiresDefault                              "access plus 1 month"
ExpiresByType text/html                     "access plus 1 seconds"
ExpiresByType text/xml                      "access plus 1 seconds"
ExpiresByType text/plain                    "access plus 1 seconds"
ExpiresByType application/xml               "access plus 1 seconds"
ExpiresByType application/json              "access plus 1 seconds"
ExpiresByType application/rss+xml           "access plus 1 hour"
ExpiresByType text/css                      "access plus 1 month" 
ExpiresByType text/javascript               "access plus 1 month" 
ExpiresByType application/javascript        "access plus 1 month" 
ExpiresByType application/x-javascript      "access plus 1 month" 
ExpiresByType image/x-ico                   "access plus 1 month"
ExpiresByType image/x-icon                  "access plus 1 month" 
ExpiresByType image/gif                     "access plus 1 month"
ExpiresByType image/png                     "access plus 1 month"
ExpiresByType image/jpe                     "access plus 1 month"
ExpiresByType image/jpg                     "access plus 1 month"
ExpiresByType image/jpeg                    "access plus 1 month"
ExpiresByType font/truetype                 "access plus 1 month"
ExpiresByType font/opentype                 "access plus 1 month"
ExpiresByType application/x-font-woff       "access plus 1 month"
ExpiresByType video/ogg                     "access plus 1 month"
ExpiresByType audio/ogg                     "access plus 1 month"
ExpiresByType video/mp4                     "access plus 1 month"
ExpiresByType video/webm                    "access plus 1 month"
ExpiresByType image/svg+xml                 "access plus 1 month"
ExpiresByType application/pdf               "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

To learn more about using .htaccess to configure smart browser-caching rules, check out the “Optimizing performance” chapter in my book, .htaccess made easy. Cheers!

Learn more

.htaccess made easy


Show Support

Like our new Facebook Page to show support!