{"id":6422,"date":"2025-11-24T11:54:37","date_gmt":"2025-11-24T06:24:37","guid":{"rendered":"https:\/\/youstable.com\/blog\/?post_type=epkb_post_type_1&#038;p=3584"},"modified":"2025-11-24T11:54:40","modified_gmt":"2025-11-24T06:24:40","slug":"how-to-add-expires-headers","status":"publish","type":"post","link":"https:\/\/www.youstable.com\/blog\/how-to-add-expires-headers","title":{"rendered":"How to Add Expires Headers To Your WordPress Website?"},"content":{"rendered":"\n<p>Let&#8217;s see what is Expires Headers and how to add expires headers to your WordPress website step-by-step.<\/p>\n\n\n\n<p>Expires headers are the protocols or rules which is used by the web browsers to know whether to load a web page resources like images, videos etc. from the visitor\u2019s browser cache or from the server directly.<\/p>\n\n\n\n<p>If web page resources will be loaded from your cache, results in the reduction of server load and improved performance of your website.<\/p>\n\n\n\n<p>In this article, we\u2019ll show you how to add expires headers in WordPress.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>By adding a WordPress Plugin<\/li>\n\n\n\n<li>By adding the code manually<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"by-adding-a-wordpress-plugin\"><strong> <span style=\"font-size: revert; background-color: initial;\">By adding a WordPress Plugin<\/span> <\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Login into your wordpress dashboard and go to <strong>Plugins<\/strong>.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized is-style-default\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image.png\" alt=\"\" class=\"wp-image-3537\" width=\"574\" height=\"606\"><\/figure>\n\n\n\n<p>2. Click &#8220;<strong>Add New<\/strong>&#8220;, search for &#8220;<strong>W3 Total Cache<\/strong>&#8221; and click on <strong>Install Now<\/strong> button.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"624\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-2.png\" alt=\"\" class=\"wp-image-3540\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-2.png 772w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-2-768x621.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<p>3. Click <strong>&#8220;Activate<\/strong>&#8221; to activate the plugin.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"751\" height=\"522\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-3.png\" alt=\"\" class=\"wp-image-3541\"><\/figure>\n\n\n\n<p>4. After activation of the plugin, go to Performance &#8211;&gt; General Settings.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-4.png\" alt=\"\" class=\"wp-image-3542\" width=\"761\" height=\"447\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-4.png 1050w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-4-768x452.png 768w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/figure>\n\n\n\n<p>5. Click &#8220;<strong>Accept<\/strong>&#8221; and click on &#8220;Skip Guide&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"922\" height=\"420\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-5.png\" alt=\"\" class=\"wp-image-3543\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-5.png 922w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-5-768x350.png 768w\" sizes=\"auto, (max-width: 922px) 100vw, 922px\" \/><\/figure>\n\n\n\n<p>6. In the <strong>Page Cache<\/strong> section, select the &#8220;<strong>Disk: Enhanced<\/strong>&#8221; method and <strong>&#8220;Enabled&#8221;<\/strong> it.<br>    This method will reduce the response time of your website and increase the scale of your web server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-6.png\" alt=\"\" class=\"wp-image-3544\" width=\"917\" height=\"521\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-6.png 1028w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-6-768x437.png 768w\" sizes=\"auto, (max-width: 917px) 100vw, 917px\" \/><\/figure>\n\n\n\n<p>7. <strong>Minify<\/strong> <strong>DISABLE<\/strong><\/p>\n\n\n\n<p>Minification can sometimes break your site but shrink your site&#8217;s code without losing any of its functionality, so you should employ some caution here. Keep it in &#8220;<strong>Auto<\/strong>&#8221; mode.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1014\" height=\"561\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-7.png\" alt=\"\" class=\"wp-image-3547\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-7.png 1014w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-7-768x425.png 768w\" sizes=\"auto, (max-width: 1014px) 100vw, 1014px\" \/><\/figure>\n\n\n\n<p>8. <strong>Database cache<\/strong><\/p>\n\n\n\n<p>Caching database objects decreases the response time of your site but it\u2019s best to <strong>skip this option<\/strong> for shared hosting plans but, if you are using VPS or Dedicated Servers you can enable this option.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1094\" height=\"364\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-8.png\" alt=\"\" class=\"wp-image-3548\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-8.png 1094w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-8-768x256.png 768w\" sizes=\"auto, (max-width: 1094px) 100vw, 1094px\" \/><\/figure>\n\n\n\n<p><strong>9.<\/strong> <strong>Object Cache<\/strong><\/p>\n\n\n\n<p>Keep it disabled for shared hosting plans as <strong>Object cache <\/strong>too can draw heavily on server resources.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1036\" height=\"325\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-9.png\" alt=\"\" class=\"wp-image-3561\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-9.png 1036w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-9-768x241.png 768w\" sizes=\"auto, (max-width: 1036px) 100vw, 1036px\" \/><\/figure>\n\n\n\n<p><strong>10.<\/strong> <strong>Browser cache<\/strong><\/p>\n\n\n\n<p>You must &#8220;<strong>Enable<\/strong>&#8221;&nbsp;this option because it tells a browser to save a copy of the page resulting in reduced server load and decrease response calls to your website.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"279\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-10.png\" alt=\"\" class=\"wp-image-3567\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-10.png 993w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-10-768x216.png 768w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/figure>\n\n\n\n<p><strong>11.<\/strong> <strong>CDN(C<\/strong>ontent <strong>D<\/strong>elivery <strong>N<\/strong>etwork)- <strong>Disable<\/strong><\/p>\n\n\n\n<p>If you\u2019re using a&nbsp;<strong>Content Delivery Network <\/strong>(CDN) from any third-party service like Cloudflare, then you don&#8217;t need to enable this one. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1195\" height=\"325\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-11.png\" alt=\"\" class=\"wp-image-3568\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-11.png 1195w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-11-768x209.png 768w\" sizes=\"auto, (max-width: 1195px) 100vw, 1195px\" \/><\/figure>\n\n\n\n<p><strong>12. Reverse Proxy \u2013 DISABLE<\/strong><\/p>\n\n\n\n<p>Reverse proxies are generally required in private hosting. Therefore, <strong>Disabled <\/strong>it<strong>.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1120\" height=\"455\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-13.png\" alt=\"\" class=\"wp-image-3570\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-13.png 1120w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-13-768x312.png 768w\" sizes=\"auto, (max-width: 1120px) 100vw, 1120px\" \/><\/figure>\n\n\n\n<p>Leave all the other settings to default.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"by-adding-a-code-manually\"> <strong><span style=\"font-size: revert; background-color: initial;\">By adding a code manually<\/span><\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Login to your control panel. Here I am taking DirectAdmin panel. After login, scroll down and click on &#8220;<strong>File Manager<\/strong>&#8221; icon.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"589\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-14.png\" alt=\"\" class=\"wp-image-3571\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-14.png 956w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-14-768x473.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/figure>\n\n\n\n<p>2. Navigate to the <strong>domain<\/strong> and double-click on it. Select your <strong>domain name<\/strong>(if you are having multiple domains) then double-click on the <strong>public_html<\/strong> folder.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-16.png\" alt=\"\" class=\"wp-image-3573\" width=\"772\" height=\"446\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-16.png 1043w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-16-768x444.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/figure>\n\n\n\n<p>3. Here, you will find the .htaccess file. Right-click on this file and click&nbsp;<strong>Edit.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"773\" height=\"603\" src=\"https:\/\/youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-17.png\" alt=\"\" class=\"wp-image-3574\" srcset=\"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-17.png 773w, https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/08\/image-17-768x599.png 768w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/figure>\n\n\n\n<p>4. Copy and paste the following lines of codes into it.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;IfModule mod_expires.c&gt;\n\n  ExpiresActive On\n  # Images\n\n  ExpiresByType image\/jpeg &quot;access plus 1 year&quot;\n  ExpiresByType image\/gif &quot;access plus 1 year&quot;\n  ExpiresByType image\/png &quot;access plus 1 year&quot;\n  ExpiresByType image\/webp &quot;access plus 1 year&quot;\n  ExpiresByType image\/svg+xml &quot;access plus 1 year&quot;\n  ExpiresByType image\/x-icon &quot;access plus 1 year&quot;\n\n  # Video\n\n  ExpiresByType video\/mp4 &quot;access plus 1 year&quot;\n  ExpiresByType video\/mpeg &quot;access plus 1 year&quot;\n\n  # CSS, JavaScript\n\n  ExpiresByType text\/css &quot;access plus 1 month&quot;\n  ExpiresByType text\/javascript &quot;access plus 1 month&quot;\n  ExpiresByType application\/javascript &quot;access plus 1 month&quot;\n\n  # Others\n\n  ExpiresByType application\/pdf &quot;access plus 1 month&quot;\n  ExpiresByType application\/x-shockwave-flash &quot;access plus 1 month&quot;\n\n&lt;\/IfModule&gt;\n<\/pre><\/div>\n\n\n<p>5. If you want, you can change the time parameters as per your own settings.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>I hope this will help you in &#8220;<strong>Adding Expires Header<\/strong>&#8221; in WordPress.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s see what is Expires Headers and how to add expires headers to your WordPress website step-by-step. Expires headers are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6882,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6422","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-email"],"acf":[],"featured_image_src":"https:\/\/www.youstable.com\/blog\/wp-content\/uploads\/2021\/11\/How-to-Add-Expires-Headers-To-Your-WordPress-Website-01.jpg","author_info":{"display_name":"YouStable","author_link":"https:\/\/www.youstable.com\/blog\/author\/youstable"},"_links":{"self":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/6422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/comments?post=6422"}],"version-history":[{"count":2,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/6422\/revisions"}],"predecessor-version":[{"id":15780,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/posts\/6422\/revisions\/15780"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media\/6882"}],"wp:attachment":[{"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/media?parent=6422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/categories?post=6422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youstable.com\/blog\/wp-json\/wp\/v2\/tags?post=6422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}