Log In
Welcome to Blogiestools Ask, a blogging community where beginner and professional bloggers come to seek answers from other bloggers’ experiences.

You can ask questions related to starting a blog, monetizing a blog, marketing a blog, managing a blog, fixing a problem, the best web tech tools to use, etc.

Register or log in to ask questions or edit comments.
1 vote
How do I add expires HTTP headers to my WordPress blog without using a plugin
in Blog Optimization

1 Answer

0 votes
Best answer

To add expires headers in your WordPress blog without using a plugin 

  • Go to the .htaccess file (it is normally located in the public.html folder) or if you are using the Yoast SEO plugin access the .htaccess file from WordPress admin via Yoast>Tools>file editor>.htaccess file 
  • Copy and paste the expire headers code below the .htaccess file


<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access 1 year"
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/webp "access 1 year"
ExpiresByType image/svg+xml "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/x-icon "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/javascript "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/xhtml-xml "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresDefault "access 1 month"


  • Save changes  

What are expires headers? Expires headers is an HTTP header directive that tells a browser to download and store a web page's resources to the site visitor’s local computer browser for a set time. It also instructs the browser after how long the stored resources should be updated.

For example, if you visit a Facebook page for the first time, cached resources like (images, CSS, and JavaScript files) will be downloaded and stored in your local computer's browser. The next time you visit the same page, the resources will not be downloaded again from the page but will be loaded from the browser you used. This increases page load speed and saves data usage.

If you have files that frequently change, then it is advisable to reduce cache time or ignore browser cache. For example, HTML files.

15.3k points


0 votes
1 answer
There is a blog that is displaying several of my images in their pages and it is affecting my bandwidth and site speed
posted Oct 30, 2021 in General anonymous
0 votes
1 answer
I need a code to change WooCommerce add cart button text without installing a plugin
posted Nov 8, 2021 in WordPress Problems anonymous
0 votes
1 answer
I have created a privacy page but I do not know how to add it in the footer section of my WordPress powered blog
posted Nov 3, 2021 in WordPress Problems anonymous
0 votes
1 answer
I have several posts on my WordPress site but I want to add CSS to a specific post, how do I do
posted Nov 3, 2021 in WordPress Problems anonymous
0 votes
1 answer
How do i optimize my blog post images in WordPress
posted Nov 18, 2021 in Blog Optimization anonymous