{"id":882,"date":"2012-10-30T00:16:11","date_gmt":"2012-10-30T06:16:11","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=882"},"modified":"2026-01-09T05:49:49","modified_gmt":"2026-01-09T11:49:49","slug":"leverage-browser-caching","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/leverage-browser-caching\/","title":{"rendered":"How Can mod_expires Speed Up Your Website in Apache?"},"content":{"rendered":"<p data-start=\"1188\" data-end=\"1480\">The time that web pages take to load increases because static resources must be downloaded over the network. These resources can be cached by the browser using HTTP caching. Once a resource is cached, the browser loads the stored copy instead of downloading it again, reducing page load time.<\/p>\n<p data-start=\"1482\" data-end=\"1613\">Browser caching helps reduce the total payload size, saves bandwidth, and eliminates repeated HTTP requests for the same resources.<\/p>\n<p data-start=\"1615\" data-end=\"1832\">Cacheable resources include JavaScript and CSS files, image files, and other binary objects such as media files and PDFs. HTML files are usually dynamic and should be cached carefully, typically for shorter durations.<\/p>\n<p data-start=\"1834\" data-end=\"1992\">In Apache, browser caching is handled using the <span style=\"font-weight: 400;\">mod_expires<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">mod_headers<\/span><span style=\"font-weight: 400;\"> modules<\/span>, which control cache behavior through HTTP headers sent by the server.<\/p>\n<h3 data-start=\"1994\" data-end=\"2034\">Example Apache Expires Configuration<\/h3>\n<div class=\"contain-inline-size rounded-2xl corner-superellipse\/1.1 relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-[calc(--spacing(9)+var(--header-height))] @w-xl\/main:top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\">\n<p><em><strong>&lt;IfModule mod_expires.c&gt;<\/strong><\/em><br \/>\n<em><strong>ExpiresActive On<\/strong><\/em><\/p>\n<p><em><strong>ExpiresByType image\/jpg &#8220;access plus 1 year&#8221;<\/strong><\/em><br \/>\n<em><strong>ExpiresByType image\/jpeg &#8220;access plus 1 year&#8221;<\/strong><\/em><br \/>\n<em><strong>ExpiresByType image\/png &#8220;access plus 1 year&#8221;<\/strong><\/em><br \/>\n<em><strong>ExpiresByType image\/gif &#8220;access plus 1 year&#8221;<\/strong><\/em><br \/>\n<em><strong>ExpiresByType image\/x-icon &#8220;access plus 1 year&#8221;<\/strong><\/em><\/p>\n<p><em><strong>ExpiresByType text\/css &#8220;access plus 1 month&#8221;<\/strong><\/em><br \/>\n<em><strong>ExpiresByType application\/javascript &#8220;access plus 1 month&#8221;<\/strong><\/em><br \/>\n<em><strong>ExpiresByType application\/pdf &#8220;access plus 1 month&#8221;<\/strong><\/em><\/p>\n<p><em><strong>ExpiresDefault &#8220;access plus 2 days&#8221;<\/strong><\/em><br \/>\n<em><strong>&lt;\/IfModule&gt;<\/strong><\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h3 data-start=\"2569\" data-end=\"2584\">Explanation<\/h3>\n<ul>\n<li data-start=\"2569\" data-end=\"2584\"><span style=\"font-weight: 400;\">ExpiresDefault &#8220;access plus 2 days&#8221;<\/span><span style=\"font-weight: 400;\"> sets a default cache duration of two days for all content types<\/span><\/li>\n<li data-start=\"2569\" data-end=\"2584\"><span style=\"font-weight: 400;\">ExpiresByType image\/jpeg &#8220;access plus 1 year&#8221;<span> tells the browser to cache JPEG images for one year<\/span><\/span><\/li>\n<li data-start=\"2569\" data-end=\"2584\">Static files that rarely change can be cached for longer periods<\/li>\n<li data-start=\"2569\" data-end=\"2584\">Frequently updated resources should have shorter expiration times<\/li>\n<\/ul>\n<p>By properly configuring browser caching, you can significantly improve website performance and user experience.<\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The time that web pages take to load increases because static resources must be downloaded over the network. These resources can be cached by the browser using HTTP caching. Once&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-882","post","type-post","status-publish","format-standard","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=882"}],"version-history":[{"count":7,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions"}],"predecessor-version":[{"id":15261,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions\/15261"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}