Welcome guys. I’m Mukesh. Today we are going to learn how to add Expires header to the WordPress site. Here a quick and easy tutorial to add Expire header to website. So let’s see how we add Expire header in WordPress.
Before we start, we some talk about what is the importance
Importance of Expires Header
Finally, the main importance of the Expires Header is to reduce the load on-site and making the site faster.
How to Add Expires Header
Here are two methods of add Expire header to WordPress. One is adding by Plugin and other is adding by manually add code in htaccess file.
1. Far Future Expiry Header Plugin
This is a very easy method to add Expires header. Just install ‘Far Future Expiry Header‘ plugin to WordPress and activate this.
How you do this? Follow this step:
- Go to your dashboard
- Click on Add New in the plugin section
- Search Far Future Expiry Header and click on install
- Activate the plugin
- After activate, Go to FarFutureExpiry option in Setting option.
- Click on ‘Enable Far Future Expiration’.
- Enter the value 30 in Number of the Day option.
- 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 this following code and save it.
# Enable expirations
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"
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 LIKE: How to add Web Push Notification on WordPress