How to Add Expires Header in WordPress with This Simple Method

Welcome guys. I’m Mukesh. Today we are going to learn how to add Expires header to the WordPress site. Here is a quick and easy tutorial to add Expire header to the website. So let’s see how we add Expire header in WordPress.

Easy way to Add Expiry Header to WordPress

Before we start, we some talk about what is the importance

Importance of Expires Header

Adding Expires Headers is important to reduce HTTP requests which reduce the time it takes for the server to communicate with the browser. It also allows your users to reuse the cache files like images: jpg, gif, png, favicon/ico, javascript, CSS etc. that have been stored in the browser to reduce the number of files they need to download.

Finally, the main importance of the Expires Header is to reduce the load on-site and making the site faster.

Click here to know other methods of speed up WordPress 

How to Add Expires Header in WordPress

Here are two methods of add Expire header to WordPress. One is adding by Plugin and the other is adding by manually add code in the htaccess file.

1. Far Future Expiry Header Plugin

This is a very easy method to add Expires header. Just install the ‘Far Future Expiry Header‘ plugin to WordPress and activate this.

How do you do this? Follow this step:

  1. Go to your dashboard
  2. Click on Add New in the plugin section
  3. Search Far Future Expiry Header and click on install
  4. Activate the plugin
  5. After activate, Go to FarFutureExpiry option in Setting option.
  6. Click on ‘Enable Far Future Expiration’.
  7. Enter the value 30 in Number of the Day option.
  8. Save this.

Great job, you have all done. Now, Expire Header has been added to your website.

If you down want to install any plugin then this is another method to add Expire header without a plugin.

2. Add Expires Header htaccess

This is an advanced option to add Expires header to WordPress. In this method, we need to insert a code in the htaccess file. Remember that before you edit the htaccess file, you have to back up this. So let start:

Access your website via FTP. Find the htaccess file and open it. In the htaccess file, add the following code and save it.

# Enable expirations
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 year"

So these are two easy methods of adding Expire header in WordPress of our blog. If you have any problem with this, you can free to ask us in the comment section. Good bay.

YOU MAY LIKEHow to add Web Push Notification on WordPress

Leave a Reply

Your email address will not be published.