{"id":518,"date":"2025-05-21T09:40:53","date_gmt":"2025-05-21T13:40:53","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2013\/01\/25\/apache-module-mod-expires\/"},"modified":"2025-06-02T13:48:45","modified_gmt":"2025-06-02T17:48:45","slug":"apache-module-mod-expires","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/","title":{"rendered":"How to Add mod_expires to your .htaccess"},"content":{"rendered":"<p>When visiting a website, the website will cache in your browser. This cache can be controlled by configuring your <code>Cache-Control<\/code> HTTP headers for your website This is done by adding <strong>mod_expires<\/strong> in the <strong>.htaccess<\/strong> file of your server.<\/p>\n<p>If you don&#8217;t set your <code>Cache-Control<\/code> for the HTTP headers, then, you will have a longer wait times when visiting your website. Each time your website is accessed without <code>Cache-Control<\/code>, your website has to make a request to the server for each image, javascript file, CSS file, and so forth to load.<\/p>\n<p>Browser caching is good because it allows your web resources to be stored in the browser for faster page load time. This makes your site faster to surf on the web. To remove the cache from your browser, your browser cache needs to be cleared. For information on clearing your browser cache, please see our article on <a title=\"Clikc here to learn how to clear your cache\" href=\"\/support\/website\/clear-browser-cache-android\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to clear your browser&#8217;s cache<\/a>. The following sections will explain the basics of setting up the Apache Module <code>mod_expires<\/code> in your .htaccess.<\/p>\n<h2><b>Performance Metric Improvements<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Using mod_expires for browser caching delivers instant, tangible improvements to your site\u2019s speed and efficiency. By setting rules for how long browsers keep static files like images, CSS, and JavaScript, you cut down on redundant downloads, enhancing the user experience.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here\u2019s how it elevates key performance metrics:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Quicker page loads:<\/b><span style=\"font-weight: 400;\"> Caching slashes load times by 40\u201360% for repeat visitors, pulling static assets from local storage instead of fetching them again.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Lighter server demand:<\/b><span style=\"font-weight: 400;\"> Proper expiry headers reduce HTTP requests, freeing up server resources for smoother operation.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Higher performance ratings:<\/b><span style=\"font-weight: 400;\"> Tools like GTmetrix or Google PageSpeed Insights often report a 15\u201320 point score increase after optimizing caching.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Lower bounce rates:<\/b><span style=\"font-weight: 400;\"> Fast, seamless browsing keeps users engaged, reducing the chance they\u2019ll leave due to slow loading.<\/span><\/li>\n<\/ul>\n<h2><b>Testing Your Implementation<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">After adding mod_expires rules to your .htaccess file, confirm everything\u2019s working as intended. Testing ensures the server applies your settings correctly and delivers the expected speed gains.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Try these steps to check your implementation:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Chrome DevTools (Network tab):<\/b><span style=\"font-weight: 400;\"> Open your site, hit F12, and go to the Network tab. Reload the page and look at the Status and Size columns for resources\u2014spot \u201c(from disk cache)\u201d or \u201c(from memory cache)\u201d to confirm caching.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Look for \u201c304 Not Modified\u201d responses:<\/b><span style=\"font-weight: 400;\"> These show the browser is using cached files, proving your Expires headers are effective.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Analyze with GTmetrix or Pingdom:<\/b><span style=\"font-weight: 400;\"> These tools review your headers, highlighting which files are cached and flagging any areas for improvement.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Start fresh:<\/b><span style=\"font-weight: 400;\"> Clear your browser cache or use incognito mode before testing to ensure your updated .htaccess rules are active.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Check response headers:<\/b><span style=\"font-weight: 400;\"> Use tools like WebSniffer or browser extensions to inspect HTTP headers. Verify the presence of Expires, Cache-Control, or Last-Modified headers to confirm proper caching behavior.<\/span><\/li>\n<\/ul>\n<h2>Basic code for setting expire dates for cache<\/h2>\n<p>In order to add browser caching to your website, you will need to set the date for when the cache expires. This cache code is placed in the .htaccess found in your public_html folder. You will need to edit your <a title=\"Click here to learn what the htaccess is\" href=\"\/support\/website\/htaccess-file\/\" target=\"_blank\" rel=\"noopener noreferrer\">.htaccess<\/a> file. Add the following code to the file and save it.<\/p>\n\n\n<pre>ExpiresActive On\nExpiresByType image\/jpg \"access plus 1 year\"\nExpiresByType image\/jpeg \"access plus 1 year\"\nExpiresByType image\/gif \"access plus 1 year\"\nExpiresByType image\/png \"access plus 1 year\"\nExpiresByType text\/css \"access plus 1 month\"\nExpiresByType application\/pdf \"access plus 1 month\"\nExpiresByType text\/x-javascript \"access plus 1 month\"\nExpiresByType application\/x-shockwave-flash \"access plus 1 month\"\nExpiresByType image\/x-icon \"access plus 1 year\"\nExpiresDefault \"access plus 2 days\"<\/pre>\n\n\n<p>Now your site will set the time each for each resource that was added to the .htaccess to expire. In the previous code example, the jpg, jpeg, gif, png will expire in a year and pdf, javascript and flash files will expire in a month. More explanation o these settings will come later in this article. Next we will look at using the <code><\/code> for adding <code>Cache-Control<\/code> with <code>mod_expires<\/code>.<\/p>\n<h2>Code for <code>mod_expires<\/code> in .htaccess<\/h2>\n<p>Using <code>mod_expires<\/code> in .htaccess allows image types and other file types to be set in an array. This matches the file types to the specific expire time. This streamlines the htaccess code. In the code below, the file types are listed in a row like <code>jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3<\/code>. Below is an example of the code to use.<\/p>\n\n\n<pre>&lt;filesmatch \".(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$\"=\"\"&rt;\nExpiresActive on\nExpiresDefault \"access plus 2 days\"<\/pre>\n\n\n<p>This sets the cache to expire to the same duration for each of the file types. To specify the specific times for each individual file type, you will want to use the previous code example. The following will explain the Directive types that are used for <code>Cache-Control<\/code>.<\/p>\n<h3>Directive types<\/h3>\n<p>There are three directive types; <code>ExpiresActive<\/code>, <code>ExpiresByType<\/code>, and <code>ExpiresDefault<\/code>. The following table explains the difference between them.<\/p>\n<table class=\"article_table\" border=\"0\">\n<tbody>\n<tr>\n<th style=\"text-align: center;\" colspan=\"2\">Caching directives<\/th>\n<\/tr>\n<tr>\n<th>ExpiresActive Directive<\/th>\n<td>Enables the Expires headers for the website.<\/td>\n<\/tr>\n<tr>\n<th>ExpiresByType Directive<\/th>\n<td>This defines the age of the cache header and the type of file to cache.<\/td>\n<\/tr>\n<tr>\n<th>ExpiresDefault Directive<\/th>\n<td>This sets the age of the cache for all documents other than those specified in the ExpiresByType for the site.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Caching Directive bases<\/h3>\n<p>There are 3 base types the access, now, and modification type.<\/p>\n<ul>\n<li>access<\/li>\n<li>now (same as &#8220;<em>access<\/em>&#8220;)<\/li>\n<li>modification<\/li>\n<\/ul>\n<h3>Duration of cache time<\/h3>\n<p>The duration of cache time can be set to one of the following units of time.<\/p>\n<ul>\n<li>years<\/li>\n<li>months<\/li>\n<li>weeks<\/li>\n<li>days<\/li>\n<li>hours<\/li>\n<li>minutes<\/li>\n<li>seconds<\/li>\n<\/ul>\n<h3>Basic syntax for <code>ExpiresByType<\/code> intervals<\/h3>\n<p>The following shows the basic syntax for the <code>ExpiresByType<\/code>. Each file type can be set to specific times to expire the cache.<\/p>\n<pre>ExpiresByType text\/html \"access plus 2 days 12 hours\"<\/pre>\n<pre>ExpiresByType image\/png \"access plus 6 months 3 days\"<\/pre>\n<h2>Recommended Expire date ranges<\/h2>\n<p>You do not want to set your expire times for your cache to unrealistic settings. If you keep the cache to a maximum of a year and a minimum of a month, you should have your browser caching working optimized for your site.<\/p>\n<ul>\n<li>Set your images to a long expire time like &#8220;access plus 1 year&#8221;. Images take more time to load and are updated less frequently than other files.<\/li>\n<li>Make your CSS, HTML, and Javascript expire at a minimum of a month like &#8220;access plus 1 month&#8221;. CSS, HTML and JavaScript&#8217;s typically are updated more when developing a site than the sites images.<\/li>\n<li>Keep your cache expire date at most a year.<\/li>\n<\/ul>\n<h2><b>Advanced Implementation Strategies<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Once you&#8217;ve added <\/span><span style=\"font-weight: 400;\">mod_expires<\/span><span style=\"font-weight: 400;\"> to your <\/span><span style=\"font-weight: 400;\">.htaccess<\/span><span style=\"font-weight: 400;\"> file, you can further optimize your caching strategy by tailoring it to your website\u2019s structure and user behavior. These advanced practices help maximize performance while ensuring that content remains fresh and relevant:<\/span><\/p>\n<h3><b>Align cache headers with CDN settings<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">If you&#8217;re using a Content Delivery Network (CDN), make sure your origin server&#8217;s cache headers do not conflict with the CDN&#8217;s behavior. Mismatched settings can cause stale content to persist.<\/span><\/p>\n<h3><b>Avoid caching personalized content<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">For dynamically generated or user-specific content (e.g., logged-in pages), use <\/span><span style=\"font-weight: 400;\">ExpiresDefault &#8220;access plus 0 seconds&#8221;<\/span><span style=\"font-weight: 400;\"> to ensure users always see the most recent version.<\/span><\/p>\n<h3><b>Implement cache-busting<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Append version numbers to your asset URLs (e.g., <\/span><span style=\"font-weight: 400;\">main.js?v=2.0<\/span><span style=\"font-weight: 400;\">) to force browsers to fetch updated files when needed.<\/span><\/p>\n<h3><b>Different cache durations for device types<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">If your site serves different assets to desktop and mobile visitors, consider applying distinct cache rules via conditional logic or server-side user-agent detection.<\/span><\/p>\n<h3><b>Follow HTML5 boilerplate best practices<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The HTML5 Boilerplate project advises setting HTML documents to expire immediately (<\/span><span style=\"font-weight: 400;\">access plus 0 seconds<\/span><span style=\"font-weight: 400;\">) while caching static resources (CSS, JS, images) for longer durations.<\/span><\/p>\n<h3><b>Troubleshooting<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">If your caching configuration isn&#8217;t working as expected, or causes unexpected errors, there are a few common issues to review. Most problems stem from syntax errors, missing modules, or server-specific requirements.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>500 internal server error<\/b><span style=\"font-weight: 400;\">: This often results from syntax mistakes in your <\/span><span style=\"font-weight: 400;\">.htaccess<\/span><span style=\"font-weight: 400;\"> file. Double-check your directives and ensure proper formatting.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>mod_expires not enabled<\/b><span style=\"font-weight: 400;\">: Not all hosting environments enable <\/span><span style=\"font-weight: 400;\">mod_expires<\/span><span style=\"font-weight: 400;\"> by default. Contact your hosting provider to confirm it\u2019s active on your server.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Issues with <\/b><b>&lt;FilesMatch&gt;<\/b><b> directives<\/b><span style=\"font-weight: 400;\">: Some hosting setups require full file paths in <\/span><span style=\"font-weight: 400;\">&lt;FilesMatch&gt;<\/span><span style=\"font-weight: 400;\"> rules. Try switching to relative paths if your directives don&#8217;t seem to take effect.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>External resources not caching<\/b><span style=\"font-weight: 400;\">: Files loaded from third-party domains (e.g., fonts, analytics) will not inherit your server\u2019s caching rules. These must have their own cache headers set by the source domain.<\/span><\/li>\n<\/ul>\n<h2><b>Mod_expires best practices<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Effective caching requires a strategic balance between performance and content freshness. By following these best practices, you can ensure your use of <\/span><span style=\"font-weight: 400;\">mod_expires<\/span><span style=\"font-weight: 400;\"> improves load times without compromising on content accuracy or user experience:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Use versioning for assets<\/b><span style=\"font-weight: 400;\">: Append version numbers to file names or query strings (e.g., <\/span><span style=\"font-weight: 400;\">style.css?v=3.4<\/span><span style=\"font-weight: 400;\">) to invalidate cached files when updates are made. This ensures users always get the latest version.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Balance freshness and performance<\/b><span style=\"font-weight: 400;\">: Longer cache durations reduce server load and speed up repeat visits, but make it harder to deliver updated content. Choose cache times that reflect how frequently assets change.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Exclude dynamic directories<\/b><span style=\"font-weight: 400;\">: Prevent caching in areas of your site that serve real-time or personalized content. For example:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">&lt;If &#8220;%{REQUEST_URI} =~ m#^\/dynamic-content\/#&#8221;&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u00a0\u00a0ExpiresActive Off<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&lt;\/If&gt;<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Adjust during development<\/b><span style=\"font-weight: 400;\">: While building or testing your site, use short cache durations or disable caching entirely to ensure changes reflect immediately.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Segment by user type<\/b><span style=\"font-weight: 400;\">: Logged-in users often see personalized content, so consider shorter cache times for them compared to anonymous visitors who receive static content.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Test across browsers and devices<\/b><span style=\"font-weight: 400;\">: Older browsers may interpret cache headers inconsistently. Validate your setup in multiple environments to avoid unexpected behavior.<\/span><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>When visiting a website, the website will cache in your browser. This cache can be controlled by configuring your Cache-Control HTTP headers for your website This is done by adding mod_expires in the .htaccess file of your server. If you don&#8217;t set your Cache-Control for the HTTP headers, then, you will have a longer wait<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4355],"tags":[],"class_list":["post-518","post","type-post","status-publish","format-standard","hentry","category-apache"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Add mod_expires to Your .htaccess File<\/title>\n<meta name=\"description\" content=\"Setting your website to leverage its cache will optimize the site performance. This article explains how to add Apache mod_expires caching to your .htaccesss.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Add mod_expires to Your .htaccess File\" \/>\n<meta property=\"og:description\" content=\"Setting your website to leverage its cache will optimize the site performance. This article explains how to add Apache mod_expires caching to your .htaccesss.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-21T13:40:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-02T17:48:45+00:00\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"How to Add mod_expires to your .htaccess\",\"datePublished\":\"2025-05-21T13:40:53+00:00\",\"dateModified\":\"2025-06-02T17:48:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\"},\"wordCount\":1495,\"commentCount\":49,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Apache\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\",\"name\":\"How to Add mod_expires to Your .htaccess File\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2025-05-21T13:40:53+00:00\",\"dateModified\":\"2025-06-02T17:48:45+00:00\",\"description\":\"Setting your website to leverage its cache will optimize the site performance. This article explains how to add Apache mod_expires caching to your .htaccesss.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Add mod_expires to your .htaccess\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Add mod_expires to Your .htaccess File","description":"Setting your website to leverage its cache will optimize the site performance. This article explains how to add Apache mod_expires caching to your .htaccesss.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/","og_locale":"en_US","og_type":"article","og_title":"How to Add mod_expires to Your .htaccess File","og_description":"Setting your website to leverage its cache will optimize the site performance. This article explains how to add Apache mod_expires caching to your .htaccesss.","og_url":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2025-05-21T13:40:53+00:00","article_modified_time":"2025-06-02T17:48:45+00:00","author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"How to Add mod_expires to your .htaccess","datePublished":"2025-05-21T13:40:53+00:00","dateModified":"2025-06-02T17:48:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/"},"wordCount":1495,"commentCount":49,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Apache"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/","url":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/","name":"How to Add mod_expires to Your .htaccess File","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2025-05-21T13:40:53+00:00","dateModified":"2025-06-02T17:48:45+00:00","description":"Setting your website to leverage its cache will optimize the site performance. This article explains how to add Apache mod_expires caching to your .htaccesss.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/apache-module-mod-expires\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Add mod_expires to your .htaccess"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4355,"name":"Apache","slug":"apache","link":"https:\/\/www.inmotionhosting.com\/support\/server\/apache\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/518","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=518"}],"version-history":[{"count":9,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/518\/revisions"}],"predecessor-version":[{"id":130223,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/518\/revisions\/130223"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}