Skip links
Published on: Website

How to Add Expires Header WordPress

Add Expires Header WordPress

Add Expires Header WordPress. What is Expires Header? How to Add Expires Header WordPress?

WordPress is the best content management tool. It has so many features which help your site to grow well. It also constantly keep on working hard making their platform even better. In terms of functionality, WordPress provides its users with features. In this article, e are going to discuss one such feature. This does not exactly feature. But a good step you can take in case you need that. This article is based on Expires Headers. What this actually is and How you can add expires header in WordPress.

What is Expires Header?

They are guided to the browser of the visitor from the website. It decides how long is your browser supposed to keep resources of the website in its caches. Expire header determines and fetches new versions of resources or the used cache. There are different type of requirements for updating. Hence the different type of resources can provide different expiry time. Expire headers are a very useful component for high-end websites and rich content pages.

It is a great way to speed up your website. To add expires header to the configuration of your .htaccess file. When your browser use caches the number of HTTP request decreases. This helps your website load faster than usual. As you already must be aware of websites are made up with help of static-like HTML, CSS, JavaScript etc. These files are the reason your page appears online. And they rarely change. Whenever HTTP request the server the browser checks if these files are in place or not or have been expired.

We can conclude that browser uses these caches. To load your page via using previous request sent on visitors browsers. This cut off time of loading page each time.

How to add expire header?

WordPress has plugin for almost every possible problem on WordPress. Therefore we have two methods by which we can add expire header to WordPress. Plugin method and Manual Method.

Plugin Method

Plugins are simple to use. For this, we are going to use the Far Future Expiry Header. This plugin updates constantly. Have great ratings and reviews. And is not poorly coded. As we know using poorly coded plugins and themes can affect your site badly. This plugin is compatible with the recent WordPress version. All you need to do is go to WordPress.org site. Download the plugin install and activate. You can follow this instructions given below:

  • Go to Dashboard.
  • Click on Plugins > Add new.
  • Search ‘Far Future Expiry Header
  • Download, Install and Activate.
  • Now go to Plugins option > ‘Far Future Expiry Header’
  • Move to respective plugin settings.
  • Click on Enable ‘Far Future Expiration’.
  • Give the details of expiration days example 30 days.
  • And save changes.

Manual Method

In manual method you add some codes to .htaccess file. So before you go for this method firstly, you need to first take backup of your site data. We also need a FTP Client you can use Filezilla for that. Now get into your sites filer through Filezilla FTP Client. Now find .htaccess file. When you find the file. Open that file and edit the code given below.

# 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”

Thank you for visiting us, keep reading.

Leave a comment